[Libreoffice-commits] .: sc/inc sc/source

2013-01-30 Thread Libreoffice Gerrit user
 sc/inc/column.hxx|2 ++
 sc/inc/document.hxx  |   12 
 sc/inc/table.hxx |2 ++
 sc/source/core/data/column.cxx   |   35 +++
 sc/source/core/data/document.cxx |   16 
 sc/source/core/data/table2.cxx   |   12 
 sc/source/ui/app/scmod.cxx   |   29 +++--
 7 files changed, 102 insertions(+), 6 deletions(-)

New commits:
commit 54ebe3df4a4c24dec7c38487a7da387fee266321
Author: Kohei Yoshida 
Date:   Wed Jan 30 15:55:58 2013 -0500

bnc#615317: Recompile cells with #NAME! for English function name option.

When the option for using English function name changes, we should 
re-compile
all cells with #NAME! as the error may have been caused by unresolved 
function
name which may be fixed after the option change.

Change-Id: Id340ce9b5db3ed368b98e814861be5c3f96df071

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index f4370a9..f6dff3b 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -251,6 +251,8 @@ public:
 voidCompileAll();
 voidCompileXML( ScProgress& rProgress );
 
+bool CompileErrorCells(sal_uInt16 nErrCode);
+
 voidResetChanged( SCROW nStartRow, SCROW nEndRow );
 
 boolUpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, 
SCROW nRow1, SCTAB nTab1,
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c3dd990..6483c65 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -860,6 +860,18 @@ public:
 voidCompileAll();
 voidCompileXML();
 
+/**
+ * Re-compile formula cells with error.
+ *
+ * @param nErrCode specified error code to match. Only those cells with
+ * this error code will be re-compiled.  If this value is
+ * 0, cells with any error values will be re-compiled.
+ *
+ * @return true if at least one cell is re-compiled, false if no cells are
+ * re-compiled.
+ */
+bool CompileErrorCells(sal_uInt16 nErrCode);
+
 ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; }
 SC_DLLPUBLIC  void SetAutoNameCache(  ScAutoNameCache* pCache 
);
 
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 30eb97a..fd2aece 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -447,6 +447,8 @@ public:
 voidCompileAll();
 voidCompileXML( ScProgress& rProgress );
 
+bool CompileErrorCells(sal_uInt16 nErrCode);
+
 voidUpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, 
SCROW nRow1, SCTAB nTab1,
 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
 SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 01f85fe..b74d325 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2135,6 +2135,41 @@ void ScColumn::CompileXML( ScProgress& rProgress )
 }
 }
 
+bool ScColumn::CompileErrorCells(sal_uInt16 nErrCode)
+{
+if (maItems.empty())
+return false;
+
+bool bCompiled = false;
+std::vector::iterator it = maItems.begin(), itEnd = 
maItems.end();
+for (; it != itEnd; ++it)
+{
+ScBaseCell* pCell = it->pCell;
+if (pCell->GetCellType() != CELLTYPE_FORMULA)
+// Not a formula cell. Skip it.
+continue;
+
+ScFormulaCell* pFCell = static_cast(pCell);
+sal_uInt16 nCurError = pFCell->GetRawError();
+if (!nCurError)
+// It's not an error cell. Skip it.
+continue;
+
+if (nErrCode && nCurError != nErrCode)
+// Error code is specified, and it doesn't match. Skip it.
+continue;
+
+pFCell->GetCode()->SetCodeError(0);
+pFCell->SetCompile(true);
+OUStringBuffer aBuf;
+pFCell->GetFormula(aBuf, pDocument->GetGrammar());
+pFCell->Compile(aBuf.makeStringAndClear(), false, 
pDocument->GetGrammar());
+
+bCompiled = true;
+}
+
+return bCompiled;
+}
 
 void ScColumn::CalcAfterLoad()
 {
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 1b11231..8667b3f 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3381,6 +3381,22 @@ void ScDocument::CompileXML()
 SetAutoCalc( bOldAutoCalc );
 }
 
+bool ScDocument::CompileErrorCells(sal_uInt16 nErrCode)
+{
+bool bCompiled = false;
+TableContainer::iterator it = maTabs.begin(), itEnd = maTabs.end();
+for (; it != itEnd; ++it)
+{
+ScTable* pTab = *it;
+if (!pTab)
+continue;
+
+if (pTab->CompileErrorCells(nErrCode))
+bCompiled = true;
+}
+
+return bCompiled;
+}
 
 void ScDocument::CalcAfterLoad()
 {
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2

[Libreoffice-commits] .: sc/inc sc/source

2013-01-29 Thread Libreoffice Gerrit user
 sc/inc/attrib.hxx|1 -
 sc/inc/dpobject.hxx  |4 ++--
 sc/source/core/data/documen8.cxx |9 +++--
 sc/source/core/data/dpobject.cxx |   37 ++---
 4 files changed, 35 insertions(+), 16 deletions(-)

New commits:
commit ef6761fd95b52fc5f444dd076478300fa448ee0d
Author: Kohei Yoshida 
Date:   Tue Jan 29 22:29:09 2013 -0500

Slightly better way to skip pivot table ranges during spell check.

Change-Id: I43e45cbd11f532f35ca9f0063236850ebc2e518e

diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index 08979c2..562505d 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -94,7 +94,6 @@ public:
 boolIsOverlapped() const{ return ( GetValue() & ( SC_MF_HOR | 
SC_MF_VER ) ) != 0; }
 
 boolHasAutoFilter() const   { return ( GetValue() & SC_MF_AUTO ) 
!= 0; }
-boolHasDPTable() const  { return ( GetValue() & SC_MF_DP_TABLE 
) != 0; }
 
 boolIsScenario() const  { return ( GetValue() & SC_MF_SCENARIO 
) != 0; }
 
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index b0971ac..2c09436 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -64,6 +64,7 @@ class ScSheetSourceDesc;
 struct ScPivotField;
 class ScDPTableData;
 class ScDPDimensionSaveData;
+class ScRangeList;
 
 struct ScDPServiceDesc
 {
@@ -389,12 +390,11 @@ public:
 void FreeTable(ScDPObject* pDPObj);
 SC_DLLPUBLIC bool InsertNewTable(ScDPObject* pDPObj);
 
-bool HasDPTable(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
-
 SheetCaches& GetSheetCaches();
 NameCaches& GetNameCaches();
 DBCaches& GetDBCaches();
 
+ScRangeList GetAllTableRanges( SCTAB nTab ) const;
 bool IntersectsTableByColumns( SCCOL nCol1, SCCOL nCol2, SCROW nRow, SCTAB 
nTab ) const;
 bool IntersectsTableByRows( SCCOL nCol, SCROW nRow1, SCROW nRow2, SCTAB 
nTab ) const;
 bool HasTable( const ScRange& rRange ) const;
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index d36453b..134fdf3 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -668,6 +668,11 @@ bool ScDocument::OnlineSpellInRange( const ScRange& 
rSpellRange, ScAddress& rSpe
 return false;
 }
 }
+
+ScRangeList aPivotRanges;
+if (pDPCollection)
+aPivotRanges = pDPCollection->GetAllTableRanges(nTab);
+
 ScHorizontalCellIterator aIter( this, nTab,
 rSpellRange.aStart.Col(), nRow,
 rSpellRange.aEnd.Col(), 
rSpellRange.aEnd.Row() );
@@ -678,8 +683,8 @@ bool ScDocument::OnlineSpellInRange( const ScRange& 
rSpellRange, ScAddress& rSpe
 
 for (; pCell; pCell = aIter.GetNext(nCol, nRow))
 {
-if (pDPCollection && pDPCollection->HasDPTable(nCol, nRow, nTab))
-// Don't spell check within datapilot table.
+if (!aPivotRanges.empty() && aPivotRanges.In(ScAddress(nCol, nRow, 
nTab)))
+// Don't spell check within pivot tables.
 continue;
 
 CellType eType = pCell->GetCellType();
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 6823ed5..e75e1d5 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -641,6 +641,27 @@ public:
 }
 };
 
+class AccumulateOutputRanges : std::unary_function
+{
+ScRangeList maRanges;
+SCTAB mnTab;
+public:
+AccumulateOutputRanges(SCTAB nTab) : mnTab(nTab) {}
+AccumulateOutputRanges(const AccumulateOutputRanges& r) : 
maRanges(r.maRanges), mnTab(r.mnTab) {}
+
+void operator() (const ScDPObject& rObj)
+{
+const ScRange& rRange = rObj.GetOutRange();
+if (mnTab != rRange.aStart.Tab())
+// Not on this sheet.
+return;
+
+maRanges.Join(rRange);
+}
+
+ScRangeList getRanges() const { return maRanges; }
+};
+
 }
 
 ScDPTableData* ScDPObject::GetTableData()
@@ -3452,17 +3473,6 @@ bool ScDPCollection::InsertNewTable(ScDPObject* pDPObj)
 return true;
 }
 
-bool ScDPCollection::HasDPTable(SCCOL nCol, SCROW nRow, SCTAB nTab) const
-{
-const ScMergeFlagAttr* pMergeAttr = static_cast(
-mpDoc->GetAttr(nCol, nRow, nTab, ATTR_MERGE_FLAG));
-
-if (!pMergeAttr)
-return false;
-
-return pMergeAttr->HasDPTable();
-}
-
 ScDPCollection::SheetCaches& ScDPCollection::GetSheetCaches()
 {
 return maSheetCaches;
@@ -3478,6 +3488,11 @@ ScDPCollection::DBCaches& ScDPCollection::GetDBCaches()
 return maDBCaches;
 }
 
+ScRangeList ScDPCollection::GetAllTableRanges( SCTAB nTab ) const
+{
+return std::for_each(maTables.begin(), maTables.end(), 
AccumulateOutputRanges(nTab)).getRanges();
+}
+
 bool ScDPCollection::IntersectsTableByColumns( SCCOL nCol1, SCCOL nCol2, SCROW 
nRow, SCTAB nTab ) const
 {
 return std::find_if(
___
Libreoffice-commits mailing list
libreoffice-com

[Libreoffice-commits] .: sc/inc sc/source

2013-01-25 Thread Libreoffice Gerrit user
 sc/inc/drwlayer.hxx  |1 +
 sc/source/core/data/drwlayer.cxx |7 +++
 sc/source/ui/view/viewfun7.cxx   |8 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 545737df40880875304bffc3f49800d1d2e99723
Author: Kohei Yoshida 
Date:   Fri Jan 25 12:57:14 2013 -0500

fdo#59056: Re-calculate cell anchor position of a pasted drawing object.

Else it would re-use the anchor position of the original one (minus the
sheet index which is correctly adjusted).

Change-Id: I52d11eb9953ee7539c9d5da41edd7dd28604587c

diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index 298d619..72b980d 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -166,6 +166,7 @@ public:
 String  GetNewGraphicName( long* pnCounter = NULL ) const;
 voidEnsureGraphicNames();
 
+static bool IsCellAnchored( const SdrObject& rObj );
 static void SetPageAnchored( SdrObject& );
 static void SetCellAnchored( SdrObject&, const ScDrawObjData 
&rAnchor );
 // Updates rAnchor based on position of rObj
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 76d6794..8ea4fca 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1787,6 +1787,13 @@ void ScDrawLayer::UpdateCellAnchorFromPositionEnd( 
SdrObject &rObj, const ScDocu
 pAnchor->maEndOffset.X() = aCellRect.Right()-aObjRect.Left();
 }
 
+bool ScDrawLayer::IsCellAnchored( const SdrObject& rObj )
+{
+// Cell anchored object always has a user data, to store the anchor cell
+// info. If it doesn't then it's page-anchored.
+return GetFirstUserDataOfType(&rObj, SC_UD_OBJDATA) != NULL;
+}
+
 void ScDrawLayer::SetPageAnchored( SdrObject &rObj )
 {
 DeleteFirstUserDataOfType(&rObj, SC_UD_OBJDATA);
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index aea107f..07e4f1f 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -172,8 +172,8 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, 
SdrModel* pModel,
 pDestPage->InsertObject( pNeuObj );
 pScDrawView->AddUndo(new SdrUndoInsertObj( *pNeuObj ));
 
-//  Chart braucht nicht mehr getrennt behandelt zu werden,
-//  weil es seine Daten jetzt selber hat
+if (ScDrawLayer::IsCellAnchored(*pNeuObj))
+ScDrawLayer::SetCellAnchoredFromPosition(*pNeuObj, 
*GetViewData()->GetDocument(), nTab);
 }
 }
 
@@ -238,6 +238,10 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, 
SdrModel* pModel,
 {
 if ( pObject->ISA(SdrUnoObj) && pObject->GetLayer() != 
SC_LAYER_CONTROLS )
 pObject->NbcSetLayer(SC_LAYER_CONTROLS);
+
+if (ScDrawLayer::IsCellAnchored(*pObject))
+ScDrawLayer::SetCellAnchoredFromPosition(*pObject, 
*GetViewData()->GetDocument(), nTab);
+
 pObject = aIter.Next();
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source xmloff/source

2013-01-23 Thread Libreoffice Gerrit user
 sc/inc/unonames.hxx |1 +
 sc/source/ui/unoobj/chart2uno.cxx   |8 +++-
 xmloff/source/chart/SchXMLTools.cxx |   30 +-
 3 files changed, 33 insertions(+), 6 deletions(-)

New commits:
commit 043e30baedb42dbc8799003ea2ae7987a97871ca
Author: Kohei Yoshida 
Date:   Wed Jan 23 22:18:05 2013 -0500

fdo#58562: Ensure internal data is always used when pasting to another doc.

Without this, pasting a chart object from one Calc doc to another may
occasionally incorrectly switch to range references *if* the destination
document contains the "right" set of sheet names.  With this fix, pasted
chart objects always switch to internal cached data source when pasting
to another document, while retaining range references when pasting within
the same document.

Change-Id: If1dbc854c5faae62f06ece155fad470b229ca0c7

diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index ca89837..9ab1856 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -652,6 +652,7 @@
 #define SC_UNONAME_HIDDENVALUES "HiddenValues"
 #define SC_UNONAME_INCLUDEHIDDENCELLS   "IncludeHiddenCells"
 #define SC_UNONAME_HIDDENVALUES "HiddenValues"
+#define SC_UNONAME_USE_INTERNAL_DATA_PROVIDER "UseInternalDataProvider"
 
 // Solver
 #define SC_UNONAME_TIMEOUT  "Timeout"
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 5c2dc07..cd94ab9 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -77,7 +77,8 @@ const SfxItemPropertyMapEntry* 
lcl_GetDataProviderPropertyMap()
 {
 static SfxItemPropertyMapEntry aDataProviderPropertyMap_Impl[] =
 {
-{MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0,
&getBooleanCppuType(),  0, 0 },
+{ MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0, 
&getBooleanCppuType(), 0, 0 },
+{ MAP_CHAR_LEN(SC_UNONAME_USE_INTERNAL_DATA_PROVIDER), 0, 
&getBooleanCppuType(), 0, 0 },
 {0,0,0,0,0,0}
 };
 return aDataProviderPropertyMap_Impl;
@@ -2326,6 +2327,11 @@ uno::Any SAL_CALL ScChart2DataProvider::getPropertyValue(
 uno::Any aRet;
 if ( rPropertyName == SC_UNONAME_INCLUDEHIDDENCELLS )
 aRet <<= m_bIncludeHiddenCells;
+else if (rPropertyName == SC_UNONAME_USE_INTERNAL_DATA_PROVIDER)
+{
+// This is a read-only property.
+aRet <<= static_cast(m_pDocument->PastingDrawFromOtherDoc());
+}
 else
 throw beans::UnknownPropertyException();
 return aRet;
diff --git a/xmloff/source/chart/SchXMLTools.cxx 
b/xmloff/source/chart/SchXMLTools.cxx
index db3a7f8..2e469a4 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -377,14 +377,34 @@ Reference< chart2::data::XDataSequence > 
CreateDataSequence(
 return xRet;
 }
 
-try
+bool bUseInternal = false;
+uno::Reference xPropSet(xDataProvider, 
uno::UNO_QUERY);
+if (xPropSet.is())
 {
-xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( 
lcl_ConvertRange( rRange, xDataProvider )));
-SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange );
+try
+{
+sal_Bool bVal;
+uno::Any any = 
xPropSet->getPropertyValue("UseInternalDataProvider");
+if (any >>= bVal)
+bUseInternal = static_cast(bVal);
+}
+catch (const beans::UnknownPropertyException&)
+{
+// Do nothing
+}
 }
-catch( const lang::IllegalArgumentException & )
+
+if (!bUseInternal)
 {
-OSL_FAIL( "could not create data sequence" );
+try
+{
+xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( 
lcl_ConvertRange( rRange, xDataProvider )));
+SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange );
+}
+catch( const lang::IllegalArgumentException & )
+{
+OSL_FAIL( "could not create data sequence" );
+}
 }
 
 if( !xRet.is() && !xChartDoc->hasInternalDataProvider() && 
!rRange.isEmpty() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2013-01-10 Thread Libreoffice Gerrit user
 sc/inc/document.hxx  |1 +
 sc/source/core/data/document.cxx |   11 +++
 sc/source/ui/docshell/docsh.cxx  |   38 +-
 3 files changed, 49 insertions(+), 1 deletion(-)

New commits:
commit 831d1b6e62e91e67f171bd00305651043731d496
Author: Kohei Yoshida 
Date:   Thu Jan 10 16:21:05 2013 -0500

fdo#58069: Invalidate sheet stream cache when directory path changes.

To properly regenerate hyperlinks (among other things) which depend on
the full path of the host document.

Change-Id: I44fdd5b0ef0a57bf4fae13f29f1ebacfe1ab19a8

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a72f759..7573a80 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -572,6 +572,7 @@ public:
 
 void AppendTabOnLoad(const rtl::OUString& rName);
 void SetTabNameOnLoad(SCTAB nTab, const rtl::OUString& rName);
+void InvalidateStreamOnSave();
 
 SC_DLLPUBLIC bool   InsertTab( SCTAB nPos, const rtl::OUString& 
rName,
 bool bExternalDocument = false );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 78ae823..a3e5cfa 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -402,6 +402,17 @@ void ScDocument::SetTabNameOnLoad(SCTAB nTab, const 
rtl::OUString& rName)
 maTabs[nTab]->SetName(rName);
 }
 
+void ScDocument::InvalidateStreamOnSave()
+{
+TableContainer::iterator it = maTabs.begin(), itEnd = maTabs.end();
+for (; it != itEnd; ++it)
+{
+ScTable* pTab = *it;
+if (pTab)
+pTab->SetStreamValid(false);
+}
+}
+
 bool ScDocument::InsertTab( SCTAB nPos, const rtl::OUString& rName,
 bool bExternalDocument )
 {
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index c8ff10b..2c35c01 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include "svl/urihelper.hxx"
 #include "chgtrack.hxx"
 #include "chgviset.hxx"
 #include 
@@ -1528,10 +1529,45 @@ sal_Bool ScDocShell::Save()
 return bRet;
 }
 
+namespace {
+
+/**
+ * Remove the file name from the full path, to keep only the directory path.
+ */
+void popFileName(OUString& rPath)
+{
+if (!rPath.isEmpty())
+{
+INetURLObject aURLObj(rPath);
+aURLObj.removeSegment();
+rPath = aURLObj.GetMainURL(INetURLObject::NO_DECODE);
+}
+}
+
+}
 
 sal_Bool ScDocShell::SaveAs( SfxMedium& rMedium )
 {
-RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::SaveAs" );
+OUString aCurPath; // empty for new document that hasn't been saved.
+const SfxMedium* pCurMedium = GetMedium();
+if (pCurMedium)
+{
+aCurPath = pCurMedium->GetName();
+popFileName(aCurPath);
+}
+
+if (!aCurPath.isEmpty())
+{
+// current document has a path -> not a brand-new document.
+OUString aNewPath = rMedium.GetName();
+popFileName(aNewPath);
+OUString aRel = URIHelper::simpleNormalizedMakeRelative(aCurPath, 
aNewPath);
+if (!aRel.isEmpty())
+{
+// Directory path will change before and after the save.
+aDocument.InvalidateStreamOnSave();
+}
+}
 
 ScTabViewShell* pViewShell = GetBestViewShell();
 bool bNeedsRehash = ScPassHashHelper::needsPassHashRegen(aDocument, 
PASSHASH_SHA1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2013-01-10 Thread Libreoffice Gerrit user
 sc/inc/compiler.hxx  |1 +
 sc/inc/externalrefmgr.hxx|4 ++--
 sc/source/core/tool/compiler.cxx |   31 +++
 3 files changed, 34 insertions(+), 2 deletions(-)

New commits:
commit 3d78fe6b23eb3d6552bf5ed65f3a8ead081533d1
Author: Kohei Yoshida 
Date:   Thu Jan 10 12:02:07 2013 -0500

fdo#58531: Register cells with external references at compile time.

In the old code, we would do this during interpretation.  But we need
to move that to the compilation to make this work properly without
full recalculation during ods import.

For 4.0, we'll just add calls to insertRefCells in ScCompiler.  On
master we should remove these calls from the old places to avoid
duplicate calls.  Duplicate calls for the same external file ID - cell
address pair will not hurt; it just adds more overhead.

Change-Id: I25cf2e08195da17c6c8f7d19c74d744df6e1638e

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index d40d261..10af901 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -331,6 +331,7 @@ private:
 ExtendedErrorDetection  meExtendedErrorDetection;
 boolmbCloseBrackets;// whether to close open brackets 
automatically, default TRUE
 boolmbRewind;   // whether symbol is to be rewound 
to some step during lexical analysis
+std::vector maExternalFiles;
 
 bool   NextNewToken(bool bInArray = false);
 
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 3fd3ab5..87693a3 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -679,14 +679,14 @@ public:
  */
 bool containsUnsavedReferences() { return !maUnsavedDocShells.empty(); }
 
+void insertRefCell(sal_uInt16 nFileId, const ScAddress& rCell);
+
 private:
 ScExternalRefManager();
 ScExternalRefManager(const ScExternalRefManager&);
 
 void refreshAllRefCells(sal_uInt16 nFileId);
 
-void insertRefCell(sal_uInt16 nFileId, const ScAddress& rCell);
-
 void fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCache::CellFormat* 
pFmt) const;
 
 ScExternalRefCache::TokenRef getSingleRefTokenFromSrcDoc(
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 6de0417..7b7ab88 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2717,6 +2717,7 @@ bool ScCompiler::IsDoubleReference( const String& rName )
 const OUString* pRealTab = 
pRefMgr->getRealTableName(aExtInfo.mnFileId, aExtInfo.maTabName);
 aToken.SetExternalDoubleRef(
 aExtInfo.mnFileId, pRealTab ? *pRealTab : aExtInfo.maTabName, 
aRef);
+maExternalFiles.push_back(aExtInfo.mnFileId);
 }
 else
 {
@@ -2765,6 +2766,7 @@ bool ScCompiler::IsSingleReference( const String& rName )
 const OUString* pRealTab = 
pRefMgr->getRealTableName(aExtInfo.mnFileId, aExtInfo.maTabName);
 aToken.SetExternalSingleRef(
 aExtInfo.mnFileId, pRealTab ? *pRealTab : aExtInfo.maTabName, 
aRef);
+maExternalFiles.push_back(aExtInfo.mnFileId);
 }
 else
 aToken.SetSingleReference(aRef);
@@ -2973,6 +2975,7 @@ bool ScCompiler::IsExternalNamedRange( const String& 
rSymbol )
 const OUString* pRealName = pRefMgr->getRealRangeName(nFileId, aName);
 aToken.SetExternalName(nFileId, pRealName ? *pRealName : OUString(aTmp));
 pRawToken = aToken.Clone();
+maExternalFiles.push_back(nFileId);
 return true;
 }
 
@@ -3736,6 +3739,24 @@ void ScCompiler::CreateStringFromXMLTokenArray( 
rtl::OUString& rFormula, rtl::OU
 rFormulaNmsp = aFormulaNmsp;
 }
 
+namespace {
+
+class ExternalFileInserter : std::unary_function
+{
+ScAddress maPos;
+ScExternalRefManager& mrRefMgr;
+public:
+ExternalFileInserter(const ScAddress& rPos, ScExternalRefManager& rRefMgr) 
:
+maPos(rPos), mrRefMgr(rRefMgr) {}
+
+void operator() (sal_uInt16 nFileId) const
+{
+mrRefMgr.insertRefCell(nFileId, maPos);
+}
+};
+
+}
+
 ScTokenArray* ScCompiler::CompileString( const String& rFormula )
 {
 OSL_ENSURE( meGrammar != FormulaGrammar::GRAM_EXTERNAL, 
"ScCompiler::CompileString - unexpected grammar GRAM_EXTERNAL" );
@@ -3942,6 +3963,16 @@ ScTokenArray* ScCompiler::CompileString( const String& 
rFormula )
 // remember pArr, in case a subsequent CompileTokenArray() is executed.
 ScTokenArray* pNew = new ScTokenArray( aArr );
 pArr = pNew;
+
+if (!maExternalFiles.empty())
+{
+// Remove duplicates, and register all external files found in this 
cell.
+std::sort(maExternalFiles.begin(), maExternalFiles.end());
+std::vector::iterator itEnd = 
std::unique(maExternalFiles.begin(), maExternalFiles.end());
+std::for_each(maExternalFiles.begin(), itEnd, 
ExternalFileInserter(aPos, *pDoc->GetExternalRefManager()));
+maExternalFiles.eras

[Libreoffice-commits] .: sc/inc sc/source

2013-01-08 Thread Libreoffice Gerrit user
 sc/inc/cell.hxx   |3 +--
 sc/source/core/data/cell2.cxx |   10 +-
 sc/source/core/data/column2.cxx   |3 +--
 sc/source/core/data/table6.cxx|3 +--
 sc/source/filter/html/htmlexp.cxx |5 ++---
 sc/source/filter/rtf/rtfexp.cxx   |3 +--
 sc/source/filter/xml/xmlcelli.cxx |2 +-
 sc/source/ui/app/transobj.cxx |3 +--
 sc/source/ui/docshell/docsh.cxx   |3 +--
 sc/source/ui/view/gridwin.cxx |3 +--
 sc/source/ui/view/output2.cxx |8 ++--
 sc/source/ui/view/spelleng.cxx|3 +--
 sc/source/ui/view/tabvwsha.cxx|2 +-
 sc/source/ui/view/viewfun4.cxx|6 +++---
 14 files changed, 22 insertions(+), 35 deletions(-)

New commits:
commit ab3be69580024da53653e06b34f515bef6ef690e
Author: Kohei Yoshida 
Date:   Tue Jan 8 09:51:47 2013 -0500

Let's not have two variants of this getter. One is enough.

And let's stick with the one that returns the data pointer.

Change-Id: I931be0d73adcf6f3888d05ef58bc0f905f5a6958

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 30ee12b..ee040a2 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -242,10 +242,9 @@ public:
 
 voidSetData( const EditTextObject* pObject,
 const SfxItemPool* pFromPool /* = NULL */ );
-voidGetData( const EditTextObject*& rpObject ) const;
 rtl::OUString   GetString() const;
 
-const EditTextObject* GetData() const   { return pData; }
+const EditTextObject* GetData() const;
 
 /** Removes character attribute based on new pattern attributes. */
 voidRemoveCharAttribs( const ScPatternAttr& rAttr );
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index bcf5283..c43f0c1 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -104,11 +104,6 @@ void ScEditCell::SetData( const EditTextObject* pObject,
 SetTextObject( pObject, pFromPool );
 }
 
-void ScEditCell::GetData( const EditTextObject*& rpObject ) const
-{
-rpObject = pData;
-}
-
 rtl::OUString ScEditCell::GetString() const
 {
 if ( pString )
@@ -129,6 +124,11 @@ rtl::OUString ScEditCell::GetString() const
 return rtl::OUString();
 }
 
+const EditTextObject* ScEditCell::GetData() const
+{
+return pData;
+}
+
 void ScEditCell::RemoveCharAttribs( const ScPatternAttr& rAttr )
 {
 const struct {
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 42f6cd0..5f30ebd 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -389,8 +389,7 @@ long ScColumn::GetNeededSize(
 
 if ( pCell->GetCellType() == CELLTYPE_EDIT )
 {
-const EditTextObject* pData;
-((ScEditCell*)pCell)->GetData(pData);
+const EditTextObject* pData = 
static_cast(pCell)->GetData();
 pEngine->SetTextNewDefaults(*pData, pSet);
 }
 else
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index f49ba9f..b3b183f 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -43,8 +43,7 @@ bool lcl_GetTextWithBreaks( const ScEditCell& rCell, 
ScDocument* pDoc, rtl::OUSt
 {
 //  true = more than 1 paragraph
 
-const EditTextObject* pData = NULL;
-rCell.GetData( pData );
+const EditTextObject* pData = rCell.GetData();
 EditEngine& rEngine = pDoc->GetEditEngine();
 rEngine.SetText( *pData );
 rVal = rEngine.GetText( LINEEND_LF );
diff --git a/sc/source/filter/html/htmlexp.cxx 
b/sc/source/filter/html/htmlexp.cxx
index 5045dd7..de2888e 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -1206,9 +1206,8 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, 
SCTAB nTab )
 
 sal_Bool ScHTMLExport::WriteFieldText( const ScEditCell* pCell )
 {
-sal_Bool bFields = false;
-const EditTextObject* pData;
-pCell->GetData( pData );
+bool bFields = false;
+const EditTextObject* pData = pCell->GetData();
 // text and anchor of URL fields, Doc-Engine is a ScFieldEditEngine
 EditEngine& rEngine = pDoc->GetEditEngine();
 rEngine.SetText( *pData );
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 2af2395..14c9b21 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -188,8 +188,7 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL 
nCol )
 {
 bValueData = false;
 EditEngine& rEngine = GetEditEngine();
-const EditTextObject* pObj;
-((const ScEditCell*)pCell)->GetData( pObj );
+const EditTextObject* pObj = static_cast(pCell)->GetData();
 if ( pObj )
 {
 rEngine.SetText( *pObj );
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx

[Libreoffice-commits] .: sc/inc sc/source

2013-01-08 Thread Libreoffice Gerrit user
 sc/inc/cell.hxx  |4 +
 sc/inc/docpool.hxx   |1 
 sc/inc/scitems.hxx   |   91 +++
 sc/source/core/data/cell.cxx |   17 +++--
 sc/source/core/data/docpool.cxx  |   23 +++
 sc/source/filter/excel/xicontent.cxx |   16 +
 sc/source/filter/oox/worksheethelper.cxx |   29 +
 sc/source/ui/view/gridwin.cxx|   40 +
 8 files changed, 140 insertions(+), 81 deletions(-)

New commits:
commit 92afb61d8bb1b264a945371065115981ecaed0f1
Author: Noel Power 
Date:   Tue Jan 8 10:56:44 2013 +

support new hyperlink cell attribute

Allows a hyperlink attribute to be set for a cell, allows for import of say 
a
hyperlink associated with a formula cell. Since this patch does not add
any file format support it is not possible to save such an imported 
hyperlink
to ods. Note: such a hyperlink would not have been imported in the past so 
this
should not be an issue

Change-Id: Ieb234bb6e98e4a2630b596a90972a75be12a92d4

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 521a28f..30ee12b 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -136,6 +136,8 @@ public:
 boolHasValueData() const;
 boolHasStringData() const;
 rtl::OUString   GetStringData() const;  // only real strings
+// default implementation, creates url object from passed url
+static EditTextObject* CreateURLObjectFromURL( ScDocument& rDoc, const 
OUString& rURL, const OUString& rText );
 
 static bool CellEqual( const ScBaseCell* pCell1, const ScBaseCell* 
pCell2 );
 
@@ -501,7 +503,7 @@ public:
 
 voidSetErrCode( sal_uInt16 n );
 inline bool IsHyperLinkCell() const { return pCode && 
pCode->IsHyperLink(); }
-EditTextObject* CreateURLObject() ;
+EditTextObject* CreateURLObject();
 voidGetURLResult( rtl::OUString& rURL, rtl::OUString& 
rCellText );
 
 /** Determines whether or not the result string contains more than one 
paragraph */
diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx
index 6fc0335..f187a48 100644
--- a/sc/inc/docpool.hxx
+++ b/sc/inc/docpool.hxx
@@ -40,6 +40,7 @@ class SC_DLLPUBLIC ScDocumentPool: public SfxItemPool
 static sal_uInt16*  pVersionMap9;
 static sal_uInt16*  pVersionMap10;
 static sal_uInt16*  pVersionMap11;
+static sal_uInt16*  pVersionMap12;
 
 public:
 ScDocumentPool( SfxItemPool* pSecPool = NULL, sal_Bool 
bLoadRefCounts = false );
diff --git a/sc/inc/scitems.hxx b/sc/inc/scitems.hxx
index 41181d1..e4e5238 100644
--- a/sc/inc/scitems.hxx
+++ b/sc/inc/scitems.hxx
@@ -108,54 +108,55 @@
 #define ATTR_SHADOW 152
 #define ATTR_VALIDDATA  153
 #define ATTR_CONDITIONAL154
+#define ATTR_HYPERLINK  155
 
-#define ATTR_PATTERN_END154 // end cell-attribute-pattern
+#define ATTR_PATTERN_END155 // end cell-attribute-pattern
 
-#define ATTR_PATTERN155
+#define ATTR_PATTERN156
 // page attributes
-#define ATTR_LRSPACE156 // editor: PageDesc-TabPage
-#define ATTR_ULSPACE157
-#define ATTR_PAGE   158
-#define ATTR_PAGE_PAPERTRAY 159
-#define ATTR_PAGE_PAPERBIN  160
-#define ATTR_PAGE_SIZE  161
-#define ATTR_PAGE_MAXSIZE   162
-#define ATTR_PAGE_HORCENTER 163
-#define ATTR_PAGE_VERCENTER 164
-
-#define ATTR_PAGE_ON165 // editor: header/footer-page
-#define ATTR_PAGE_DYNAMIC   166
-#define ATTR_PAGE_SHARED167
-
-#define ATTR_PAGE_NOTES 168 // editor: table
-#define ATTR_PAGE_GRID  169
-#define ATTR_PAGE_HEADERS   170
-#define ATTR_PAGE_CHARTS171
-#define ATTR_PAGE_OBJECTS   172
-#define ATTR_PAGE_DRAWINGS  173
-#define ATTR_PAGE_TOPDOWN   174
-#define ATTR_PAGE_SCALE 175
-#define ATTR_PAGE_SCALETOPAGES  176
-#define ATTR_PAGE_FIRSTPAGENO   177
-
-#define ATTR_PAGE_PRINTAREA 178 // editor: print areas
-#define ATTR_PAGE_REPEATROW 179
-#define ATTR_PAGE_REPEATCOL 180
-#define ATTR_PAGE_PRINTTABLES   181
-
-#define ATTR_PAGE_HEADERLEFT182 // contents of header/
-#define ATTR_PAGE_FOOTERLEFT183 // footer (left)
-#define ATTR_PAGE_HEADERRIGHT   184 // contents of header/
-#define ATTR_PAGE_FOOTERRIGHT   185 // footer (right)
-#define ATTR_PAGE_HEADERSET 186 // the corresponding sets
-#define ATTR_PAGE_FOOTERSET 187
-
-#define ATTR_PAGE_FORMULAS  188
-#define ATTR_PAGE_NULLVALS  189
-
-#define ATTR_PAGE_SCALETO   190 // #i8868# scale printout to 
width/height
-
-#define ATTR_HIDDEN 191
+#define ATTR_LRSPACE157 // editor: PageDesc-TabPage
+#define ATTR_ULSPACE158
+#define ATTR_PAGE   159
+#define ATTR_PAGE_PAPERTRAY 160
+#define ATTR

[Libreoffice-commits] .: sc/inc sc/source

2013-01-04 Thread Libreoffice Gerrit user
 sc/inc/compiler.hxx   |2 +-
 sc/source/filter/xml/xmlcelli.cxx |   10 --
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 3cd31cd46f38e00d4fb31cf055b9bcbb5e94e5db
Author: Markus Mohrhard 
Date:   Sat Jan 5 04:09:48 2013 +0100

don't set formula cells with possible error val clean, fdo#59039

Change-Id: Ide96d7f052ee4c8f56b33629ae48c6425a8ca19f

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index fe24511..4aa393d 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -350,7 +350,6 @@ private:
 bool IsDBRange( const String& );
 bool IsColRowName( const String& );
 bool IsBoolean( const String& );
-bool IsErrorConstant( const String& );
 void AutoCorrectParsedSymbol();
 
 void SetRelNameReference();
@@ -387,6 +386,7 @@ public:
 
 // Check if it is a valid english function name
 bool IsEnglishSymbol( const String& rName );
+bool IsErrorConstant( const String& );
 
 //! _either_ CompileForFAP _or_ AutoCorrection, _not_ both
 // #i101512# SetCompileForFAP is in formula::FormulaCompiler
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 2369dce..b67496c 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -47,6 +47,7 @@
 #include "scerrors.hxx"
 #include "editutil.hxx"
 #include "cell.hxx"
+#include "compiler.hxx"
 
 
 #include 
@@ -726,8 +727,13 @@ void 
ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 {
 if( bFormulaTextResult && pOUTextValue )
 {
-pFCell->SetHybridString( *pOUTextValue );
-pFCell->ResetDirty();
+static ScCompiler aComp(NULL, ScAddress());
+aComp.SetGrammar(formula::FormulaGrammar::GRAM_ODFF);
+if(!aComp.IsErrorConstant(*pOUTextValue))
+{
+pFCell->SetHybridString( *pOUTextValue );
+pFCell->ResetDirty();
+}
 }
 else if (!rtl::math::isNan(fValue))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-12-17 Thread Libreoffice Gerrit user
 sc/inc/globstr.hrc|5 +--
 sc/source/filter/oox/workbookfragment.cxx |   46 +++---
 sc/source/ui/src/globstr.src  |8 +
 sc/source/ui/src/optdlg.src   |2 -
 4 files changed, 16 insertions(+), 45 deletions(-)

New commits:
commit 8d5479cde68b8e70c4bfa2a6edae030260c740e4
Author: Kohei Yoshida 
Date:   Mon Dec 17 10:31:14 2012 -0500

Use check box "Always perform this in future" rather than 4 buttons.

Change-Id: Ib04debaf3c2d06e694e965c1ece01d6cc7a43fa8

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index e860a6b..4b8031d 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -619,9 +619,8 @@
 
 #define STR_QUERY_FORMULA_RECALC_ONLOAD_ODS 493
 #define STR_QUERY_FORMULA_RECALC_ONLOAD_XLS 494
-#define STR_ALWAYS  495
-#define STR_NEVER   496
+#define STR_ALWAYS_PERFORM_SELECTED 495
 
-#define STR_COUNT   497
+#define STR_COUNT   496
 
 #endif
diff --git a/sc/source/filter/oox/workbookfragment.cxx 
b/sc/source/filter/oox/workbookfragment.cxx
index 0e92e2a..4f71e57 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -327,55 +327,31 @@ void WorkbookFragment::finalizeImport()
 {
 if (rDoc.IsUserInteractionEnabled())
 {
-
-#define RET_ALWAYS 10
-#define RET_NEVER 11
 // Ask the user if full re-calculation is desired.
 QueryBox aBox(
 pDocSh->GetActiveDialogParent(), WinBits(WB_YES_NO | 
WB_DEF_YES),
 ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS));
-aBox.AddButton(ScGlobal::GetRscString(STR_ALWAYS), RET_ALWAYS, 0);
-aBox.AddButton(ScGlobal::GetRscString(STR_NEVER), RET_NEVER, 0);
+
aBox.SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED));
 
 boost::shared_ptr< comphelper::ConfigurationChanges > batch( 
comphelper::ConfigurationChanges::create() );
 sal_Int32 nRet = aBox.Execute();
-switch (nRet)
+bHardRecalc = nRet == RET_YES;
+
+if (aBox.GetCheckBoxState())
 {
-case RET_YES:
-bHardRecalc = true;
-break;
-case RET_NO:
-bHardRecalc = false;
-break;
-case RET_ALWAYS:
-{
-bHardRecalc = true;
-
officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::set(sal_Int32(0), 
batch);
-ScFormulaOptions aOpt = SC_MOD()->GetFormulaOptions();
-aOpt.SetOOXMLRecalcOptions(RECALC_ALWAYS);
-SC_MOD()->SetFormulaOptions(aOpt);
-}
-break;
-case RET_NEVER:
-{
-bHardRecalc = false;
-
officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::set(sal_Int32(2), 
batch);
-ScFormulaOptions aOpt = SC_MOD()->GetFormulaOptions();
-aOpt.SetOOXMLRecalcOptions(RECALC_NEVER);
-SC_MOD()->SetFormulaOptions(aOpt);
-}
-break;
-default:
-SAL_WARN("sc", "unknown return value!");
-bHardRecalc = true;
+// Always perform selected action in the future.
+
officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::set(sal_Int32(0), 
batch);
+ScFormulaOptions aOpt = SC_MOD()->GetFormulaOptions();
+aOpt.SetOOXMLRecalcOptions(bHardRecalc ? RECALC_ALWAYS : 
RECALC_NEVER);
+SC_MOD()->SetFormulaOptions(aOpt);
+
 }
 batch->commit();
 }
 }
-else if(nRecalcMode == 0)
+else if (nRecalcMode == 0)
 bHardRecalc = true;
 
-
 if (bHardRecalc)
 pDocSh->DoHardRecalc(false);
 else
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 955dcb5..79ad06e 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -1961,13 +1961,9 @@ Resource RID_GLOBSTR
 Text [ en-US ] = "This document was last saved by Excel.  Some formula 
cells may produce different results when recalculated.\n\nDo you want to 
recalculate all formula cells now?";
 };
 
-String STR_ALWAYS
+String STR_ALWAYS_PERFORM_SELECTED
 {
-Text [ en-US ] = "Always";
-};
-String STR_NEVER
-{
-Text [ en-US ] = "Never";
+Text [ en-US ] = "Always perform this without prompt in the future.";
 };
 };
 
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index e3a1175..821f200 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -288,7 +288,7 @@ TabPage RID

[Libreoffice-commits] .: sc/inc sc/source

2012-12-14 Thread Libreoffice Gerrit user
 sc/inc/dpcache.hxx |1 
 sc/source/core/data/dpcache.cxx|   45 -
 sc/source/core/data/dpitemdata.cxx |3 +-
 3 files changed, 43 insertions(+), 6 deletions(-)

New commits:
commit 696644dbfb25dea3030da92b2ab40cd70da90f05
Author: Kohei Yoshida 
Date:   Sat Dec 15 00:46:12 2012 -0500

fdo#35943: Better performance with pivot table refresh.

When the source data range contains trailing rows, simply skip them, and
don't even bother iterating them.  Apparently sometimes users specify a
data range with a huge amount of trailing empty rows, which would slow
down the pivot table refresh for no good reason.

But we do still need to keep the original end row position, in case the
pivot table needs to include empty cells in the output.

Change-Id: I2c73c368837b8e322e12b25ddf31429488961f06

diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 0185f9d..69d11ec 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -121,6 +121,7 @@ private:
 LabelsType maLabelNames;// Stores dimension names.
 mdds::flat_segment_tree maEmptyRows;
 SCROW mnDataSize;
+SCROW mnRowCount;
 
 bool mbDisposing;
 
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index cf03b0d..724c842 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -56,6 +56,7 @@ ScDPCache::ScDPCache(ScDocument* pDoc) :
 mnColumnCount ( 0 ),
 maEmptyRows(0, MAXROW, true),
 mnDataSize(-1),
+mnRowCount(0),
 mbDisposing(false)
 {
 }
@@ -311,6 +312,16 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const 
ScRange& rRange)
 
 mnColumnCount = nEndCol - nStartCol + 1;
 
+// this row count must include the trailing empty rows.
+mnRowCount = nEndRow - nStartRow; // skip the topmost label row.
+
+// Skip trailing empty rows if exists.
+SCCOL nCol1 = nStartCol, nCol2 = nEndCol;
+SCROW nRow1 = nStartRow, nRow2 = nEndRow;
+pDoc->ShrinkToDataArea(nDocTab, nCol1, nRow1, nCol2, nRow2);
+bool bTailEmptyRows = nEndRow > nRow2; // Trailing empty rows exist.
+nEndRow = nRow2;
+
 maFields.reserve(mnColumnCount);
 for (size_t i = 0; i < static_cast(mnColumnCount); ++i)
 maFields.push_back(new Field);
@@ -342,6 +353,17 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const 
ScRange& rRange)
 }
 
 processBuckets(aBuckets, rField);
+
+if (bTailEmptyRows)
+{
+// If the last item is not empty, append one. Note that the items
+// are sorted, and empty item should come last when sorted.
+if (rField.maItems.empty() || !rField.maItems.back().IsEmpty())
+{
+aData.SetEmpty();
+rField.maItems.push_back(aData);
+}
+}
 }
 
 PostInit();
@@ -404,6 +426,9 @@ bool ScDPCache::InitFromDataBase(DBConnector& rDB)
 
 rDB.finish();
 
+if (!maFields.empty())
+mnRowCount = maFields[0].maData.size();
+
 PostInit();
 return true;
 }
@@ -684,6 +709,8 @@ void ScDPCache::PostInit()
 
 void ScDPCache::Clear()
 {
+mnColumnCount = 0;
+mnRowCount = 0;
 maFields.clear();
 maLabelNames.clear();
 maGroupFields.clear();
@@ -723,7 +750,18 @@ SCROW ScDPCache::GetItemDataId(sal_uInt16 nDim, SCROW 
nRow, bool bRepeatIfEmpty)
 OSL_ENSURE(nDim < mnColumnCount, "ScDPTableDataCache::GetItemDataId ");
 
 const Field& rField = maFields[nDim];
-if (bRepeatIfEmpty)
+if (static_cast(nRow) >= rField.maData.size())
+{
+// nRow is in the trailing empty rows area.
+if (bRepeatIfEmpty)
+nRow = rField.maData.size()-1; // Move to the last non-empty row.
+else
+// Return the last item, which should always be empty if the
+// initialization has skipped trailing empty rows.
+return rField.maItems.size()-1;
+
+}
+else if (bRepeatIfEmpty)
 {
 while (nRow > 0 && rField.maItems[rField.maData[nRow]].IsEmpty())
 --nRow;
@@ -772,10 +810,7 @@ const ScDPItemData* ScDPCache::GetItemDataById(long nDim, 
SCROW nId) const
 
 SCROW ScDPCache::GetRowCount() const
 {
-if (maFields.empty() || maFields[0].maData.empty())
-return 0;
-
-return maFields[0].maData.size();
+return mnRowCount;
 }
 
 SCROW ScDPCache::GetDataSize() const
diff --git a/sc/source/core/data/dpitemdata.cxx 
b/sc/source/core/data/dpitemdata.cxx
index 5408714..85a6917 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -33,7 +33,8 @@ sal_Int32 ScDPItemData::Compare(const ScDPItemData& rA, const 
ScDPItemData& rB)
 {
 if (rA.meType != rB.meType)
 {
-// group value, value and string in this order.
+// group value, value and string in this order. Ensure that the empty
+// type comes last.
 return rA.meType < rB.

[Libreoffice-commits] .: sc/inc sc/source

2012-12-14 Thread Libreoffice Gerrit user
 sc/inc/viewopti.hxx  |4 ++--
 sc/source/core/tool/viewopti.cxx |   36 ++--
 2 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit 2d754521853b9ae89f4d9621150857f6592603b9
Author: Kohei Yoshida 
Date:   Fri Dec 14 22:05:11 2012 -0500

Fixed accidentally modified default view options.

It was unintentionally caused by
6ea8ea456cf5df267284278ecda42aa9b089a682.

Also made the default values easier to see.

Let's not do

  foo1 =
  foo2 =
  foo3 = true;

type of assignment which may give the reader the wrong impression.

Let's do

  foo1 = true;
  foo2 = true;
  foo3 = true;

instead.

Change-Id: I181b80d2aae96d65b662b187bc884913fec836db

diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index 4bea442..07e8c04 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -86,7 +86,7 @@ public:
 voidSetDefaults();
 
 voidSetOption( ScViewOption eOpt, sal_Bool bNew = 
sal_True ){ aOptArr[eOpt] = bNew; }
-sal_BoolGetOption( ScViewOption eOpt ) const   
 { return aOptArr[eOpt]; }
+boolGetOption( ScViewOption eOpt ) const   
 { return aOptArr[eOpt]; }
 
 voidSetObjMode( ScVObjType eObj, ScVObjMode eMode ) { 
aModeArr[eObj] = eMode; }
 ScVObjMode  GetObjMode( ScVObjType eObj ) const { 
return aModeArr[eObj]; }
@@ -103,7 +103,7 @@ public:
 int operator!= ( const ScViewOptions& rOpt ) const { 
return !(operator==(rOpt)); }
 
 private:
-sal_BoolaOptArr [MAX_OPT];
+boolaOptArr [MAX_OPT];
 ScVObjMode  aModeArr[MAX_TYPE];
 Color   aGridCol;
 String  aGridColName;
diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index d1078a5..64a4fec 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -134,24 +134,24 @@ ScViewOptions::~ScViewOptions()
 
 void ScViewOptions::SetDefaults()
 {
-aOptArr[ VOPT_FORMULAS] =
-aOptArr[ VOPT_SYNTAX  ] =
-aOptArr[ VOPT_HELPLINES   ] =
-aOptArr[ VOPT_GRID_ONTOP  ] =
-aOptArr[ VOPT_NOTES   ] =
-aOptArr[ VOPT_NULLVALS] =
-aOptArr[ VOPT_VSCROLL ] =
-aOptArr[ VOPT_HSCROLL ] =
-aOptArr[ VOPT_TABCONTROLS ] =
-aOptArr[ VOPT_OUTLINER] =
-aOptArr[ VOPT_HEADER  ] =
-aOptArr[ VOPT_GRID] =
-aOptArr[ VOPT_ANCHOR  ] =
-aOptArr[ VOPT_PAGEBREAKS  ] =
-aOptArr[ VOPT_CLIPMARKS   ] = sal_True;
-
-aModeArr[VOBJ_TYPE_OLE ]  =
-aModeArr[VOBJ_TYPE_CHART] =
+aOptArr[ VOPT_FORMULAS] = false;
+aOptArr[ VOPT_SYNTAX  ] = false;
+aOptArr[ VOPT_HELPLINES   ] = false;
+aOptArr[ VOPT_GRID_ONTOP  ] = false;
+aOptArr[ VOPT_NOTES   ] = true;
+aOptArr[ VOPT_NULLVALS] = true;
+aOptArr[ VOPT_VSCROLL ] = true;
+aOptArr[ VOPT_HSCROLL ] = true;
+aOptArr[ VOPT_TABCONTROLS ] = true;
+aOptArr[ VOPT_OUTLINER] = true;
+aOptArr[ VOPT_HEADER  ] = true;
+aOptArr[ VOPT_GRID] = true;
+aOptArr[ VOPT_ANCHOR  ] = true;
+aOptArr[ VOPT_PAGEBREAKS  ] = true;
+aOptArr[ VOPT_CLIPMARKS   ] = true;
+
+aModeArr[VOBJ_TYPE_OLE ]  = VOBJ_MODE_SHOW;
+aModeArr[VOBJ_TYPE_CHART] = VOBJ_MODE_SHOW;
 aModeArr[VOBJ_TYPE_DRAW ] = VOBJ_MODE_SHOW;
 
 aGridCol = Color( SC_STD_GRIDCOLOR );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-12-05 Thread Libreoffice Gerrit user
 sc/inc/helpids.h |1 
 sc/source/ui/inc/sortdlg.hrc |6 
 sc/source/ui/src/sortdlg.src |   57 ---
 3 files changed, 64 deletions(-)

New commits:
commit e27338143b4f8aaf8653e28a5bd6e123c7718128
Author: Caolán McNamara 
Date:   Wed Dec 5 11:51:09 2012 +

drop now unused sort resources

Change-Id: I2192872005f6cd1e85b359f209c8450034a010b1

diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 846591c..eb63a42 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -71,7 +71,6 @@
 #define HID_SC_PIVOTFILTER  
"SC_HID_SC_PIVOTFILTER"
 #define HID_SC_INPORTOPT
"SC_HID_SC_INPORTOPT"
 #define HID_SC_PIVOTSUBT
"SC_HID_SC_PIVOTSUBT"
-#define HID_SCPAGE_SORT_FIELDS  
"SC_HID_SCPAGE_SORT_FIELDS"
 #define HID_SCPAGE_SUBT_OPTIONS 
"SC_HID_SCPAGE_SUBT_OPTIONS"
 #define HID_SCPAGE_SUBT_GROUP   
"SC_HID_SCPAGE_SUBT_GROUP"
 #define HID_SCPAGE_PROTECTION   
"SC_HID_SCPAGE_PROTECTION"
diff --git a/sc/source/ui/inc/sortdlg.hrc b/sc/source/ui/inc/sortdlg.hrc
index 09409be..9834781 100644
--- a/sc/source/ui/inc/sortdlg.hrc
+++ b/sc/source/ui/inc/sortdlg.hrc
@@ -32,12 +32,6 @@
 #define WIN_MANAGESORTKEY   2
 #define SB_SORT 3
 
-// SORT_KEY_FIELDS:
-#define FL_SORT 278
-#define LB_SORT 279
-#define BTN_UP  280
-#define BTN_DOWN281
-
 #define FT_TEXT 1
 #define FT_TIP  2
 #define BTN_EXTSORT 3
diff --git a/sc/source/ui/src/sortdlg.src b/sc/source/ui/src/sortdlg.src
index b26763e..d8b6c6a 100644
--- a/sc/source/ui/src/sortdlg.src
+++ b/sc/source/ui/src/sortdlg.src
@@ -17,63 +17,6 @@
  */
 #include "sortdlg.hrc"
 
-TabPage RID_SCPAGE_SORT_FIELDS
-{
-Hide = TRUE ;
-SVLook = TRUE ;
-HelpId = HID_SCPAGE_SORT_FIELDS ;
-Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT );
-Control CTRL_MANAGESORTKEY
-{
-Pos = MAP_APPFONT( 2, 2 );
-Size = MAP_APPFONT( 256, 181 );
-Border = FALSE;
-DialogControl = TRUE;
-Window WIN_MANAGESORTKEY
-{
-OutputSize = TRUE ;
-Pos = MAP_APPFONT ( 2 , 2 );
-Size = MAP_APPFONT ( 240 , 181 );
-DialogControl = TRUE;
-};
-ScrollBar SB_SORT
-{
-Pos = MAP_APPFONT ( 246 , 2 );
-Size = MAP_APPFONT ( 8 , 181 );
-VScroll = TRUE;
-};
-};
-};
-
-ListBox LB_SORT
-{
-Border = TRUE ;
-Pos = MAP_APPFONT ( 12 , 16 ) ;
-Size = MAP_APPFONT ( 154 , 90 ) ;
-TabStop = TRUE ;
-DropDown = TRUE ;
-};
-RadioButton BTN_UP
-{
-Pos = MAP_APPFONT ( 172 , 11 ) ;
-Size = MAP_APPFONT ( 79 , 10 ) ;
-Text [ en-US ] = "~Ascending" ;
-TabStop = TRUE ;
-};
-RadioButton BTN_DOWN
-{
-Pos = MAP_APPFONT ( 172 , 25 ) ;
-Size = MAP_APPFONT ( 79 , 10 ) ;
-Text [ en-US ] = "~Descending" ;
-TabStop = TRUE ;
-};
-FixedLine FL_SORT
-{
-Pos = MAP_APPFONT ( 6 , 0 ) ;
-Size = MAP_APPFONT ( 240 , 8 ) ;
-Text [ en-US ] = "Sort ~key " ;
-};
-
 TabDialog RID_SCDLG_SORT
 {
 OutputSize = TRUE ;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-12-04 Thread Libreoffice Gerrit user
 sc/inc/document.hxx   |6 ++---
 sc/source/filter/oox/workbookfragment.cxx |   34 --
 2 files changed, 17 insertions(+), 23 deletions(-)

New commits:
commit 8f4fd2c34fbe9501c12a35eb4b392ea93524b9bb
Author: Kohei Yoshida 
Date:   Tue Dec 4 20:34:51 2012 -0500

Actually let's use the internal API directly here.

Change-Id: I1690723b11db2d6f1f5101913ab68596a44c467e

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 7986930..d38142c 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1646,9 +1646,9 @@ public:
 SvtListener* pListener );
 voidPutInFormulaTree( ScFormulaCell* pCell );
 voidRemoveFromFormulaTree( ScFormulaCell* pCell );
-voidCalcFormulaTree( bool bOnlyForced = false,
- bool bNoProgressBar = false,
- bool bDirtyFlag=true );
+SC_DLLPUBLIC void CalcFormulaTree( bool bOnlyForced = false,
+   bool bNoProgressBar = false,
+   bool bDirtyFlag=true );
 voidClearFormulaTree();
 voidAppendToFormulaTrack( ScFormulaCell* pCell );
 voidRemoveFromFormulaTrack( ScFormulaCell* pCell );
diff --git a/sc/source/filter/oox/workbookfragment.cxx 
b/sc/source/filter/oox/workbookfragment.cxx
index 896f648..3c696b6 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -20,7 +20,6 @@
 #include "workbookfragment.hxx"
 
 #include 
-#include 
 #include "oox/core/filterbase.hxx"
 #include "oox/drawingml/themefragmenthandler.hxx"
 #include "oox/helper/attributelist.hxx"
@@ -316,28 +315,23 @@ void WorkbookFragment::finalizeImport()
 finalizeWorkbookImport();
 
 // Recalculate formula cells.
-Reference< XCalculatable > xCalculatable( getDocument(), UNO_QUERY );
-if( xCalculatable.is() )
+bool bHardRecalc = false;
+ScDocument& rDoc = getScDocument();
+ScDocShell* pDocSh = static_cast(rDoc.GetDocumentShell());
+if (rDoc.IsUserInteractionEnabled())
 {
-bool bHardRecalc = false;
-ScDocument& rDoc = getScDocument();
-if (rDoc.IsUserInteractionEnabled())
-{
-// Ask the user if full re-calculation is desired.
-ScDocShell* pDocSh = 
static_cast(rDoc.GetDocumentShell());
-
-QueryBox aBox(
-pDocSh->GetActiveDialogParent(), WinBits(WB_YES_NO | 
WB_DEF_YES),
-ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS));
+// Ask the user if full re-calculation is desired.
+QueryBox aBox(
+pDocSh->GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
+ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS));
 
-bHardRecalc = aBox.Execute() == RET_YES;
-}
-
-if (bHardRecalc)
-xCalculatable->calculateAll();
-else
-xCalculatable->calculate();
+bHardRecalc = aBox.Execute() == RET_YES;
 }
+
+if (bHardRecalc)
+pDocSh->DoHardRecalc(false);
+else
+rDoc.CalcFormulaTree(false, false, false);
 }
 
 // private 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-11-29 Thread Libreoffice Gerrit user
 sc/inc/conditio.hxx  |7 +--
 sc/source/core/data/conditio.cxx |4 ++--
 2 files changed, 3 insertions(+), 8 deletions(-)

New commits:
commit ef322b54fa92877cb237a157d66408112dcc2573
Author: Stephan Bergmann 
Date:   Thu Nov 29 15:36:22 2012 +0100

Fix ScCondDateFormatEntry::mpCache

Change-Id: Iec348a367cedce8022f9be4be80adeaefab7b0a6

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index af571fd..6d23033 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -382,12 +382,7 @@ public:
 private:
 condformat::ScCondFormatDateType meType;
 
-struct ScCondDateFormatCache
-{
-Date aCachedDate;
-};
-
-boost::scoped_ptr mpCache;
+mutable boost::scoped_ptr mpCache;
 
 rtl::OUString maStyleName;
 };
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 987e75e..28d585f 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1663,9 +1663,9 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& 
rPos ) const
 return false;
 
 if( !mpCache )
-mpCache->aCachedDate = Date( Date::SYSTEM );
+mpCache.reset( new Date( Date::SYSTEM ) );
 
-const Date& rActDate = mpCache->aCachedDate;
+const Date& rActDate = *mpCache;
 SvNumberFormatter* pFormatter = mpDoc->GetFormatTable();
 long nCurrentDate = rActDate - *(pFormatter->GetNullDate());
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source svx/inc svx/source

2012-11-28 Thread Libreoffice Gerrit user
 sc/inc/drwlayer.hxx   |2 
 sc/source/core/data/drwlayer.cxx  |   26 +++---
 sc/source/ui/drawfunc/fuconarc.cxx|6 +
 sc/source/ui/drawfunc/fuconcustomshape.cxx|7 +
 sc/source/ui/drawfunc/fuconrec.cxx|8 +
 sc/source/ui/drawfunc/fuconstr.cxx|   41 +
 sc/source/ui/drawfunc/fuconuno.cxx|7 +
 sc/source/ui/drawfunc/futext.cxx  |   21 +++-
 sc/source/ui/inc/drawview.hxx |1 
 sc/source/ui/inc/fuconstr.hxx |4 
 sc/source/ui/view/drawview.cxx|   60 ++
 sc/source/ui/view/gridwin3.cxx|   12 ++
 svx/inc/svx/svdmrkv.hxx   |2 
 svx/inc/svx/svdobj.hxx|4 
 svx/source/sdr/contact/viewcontactofe3dscene.cxx  |   15 ++-
 svx/source/sdr/contact/viewcontactofgraphic.cxx   |7 +
 svx/source/sdr/contact/viewcontactofgroup.cxx |6 +
 svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx |   16 +++
 svx/source/sdr/contact/viewcontactofsdrcircobj.cxx|   10 +-
 svx/source/sdr/contact/viewcontactofsdredgeobj.cxx|   12 ++
 svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx   |   10 +-
 svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx |   13 ++-
 svx/source/sdr/contact/viewcontactofsdrole2obj.cxx|6 +
 svx/source/sdr/contact/viewcontactofsdrpathobj.cxx|5 +
 svx/source/sdr/contact/viewcontactofsdrrectobj.cxx|9 +-
 svx/source/sdr/contact/viewcontactofunocontrol.cxx|   11 +-
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx  |   23 -
 svx/source/svdraw/svdcrtv.cxx |9 +-
 svx/source/svdraw/svddrgmt.cxx|3 
 svx/source/svdraw/svdedtv1.cxx|4 
 svx/source/svdraw/svdedxv.cxx |   13 ++-
 svx/source/svdraw/svdmrkv.cxx |   33 +++
 svx/source/svdraw/svdobj.cxx  |1 
 svx/source/svdraw/svdorect.cxx|4 
 34 files changed, 355 insertions(+), 56 deletions(-)

New commits:
commit c4e649f0cd013e86adbd794859bcc3cb9ee3aa61
Author: Noel Power 
Date:   Tue Nov 27 17:56:33 2012 +

Sync draw object to calc grid for better alignment when zooming

There can be some serious rounding errors involved when calculating where to
draw the grid lines for the various row heights in a document. This can be
especially true for a document that has many different row heights.
This results in draw objects appearing to move relative to the grid line at
different zoom levels.  This patch attempts to fix this problem adjusting
the position of the shapes as they are drawn to ensure their position
relative to grid appears to be stable.  We do this by translating the 
position
of the shape to the corrosponding position of it's cell anchor. Of course 
not
all shapes are cell anchored and in this case we position the shape relative
a temporary synthesized cell anchor.
The patch essentially does the following

a) calculates the offset to be applied for each shape at the current zoom 
level
to ensure that the shape will be drawn relative to the correct cell grid
   see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx
b) apply the offset in the drawing layer for each of the different drawing
primitives see svx/source/sdr/contact/*
c) making sure the position and size of the newly created shape ( at any 
zoom
level ) are still as expected when zoom level is changed.
   see. sc/source/ui/drawfunc/fuco*.cxx &
d) making sure that overlays and handles are displayed at the correct 
position
  see svx/source/svdraw/*

it could also be that a full blown transform might be needed to additionally
scale the object ( to ensure that the edges of the object stay stable 
relative
to ajacent grid lines ) If necessary we could do that in a later step.

Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8

diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index 9f7bc56..c37937a 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -177,6 +177,8 @@ public:
 
 static void SetPageAnchored( SdrObject& );
 static void SetCellAnchored( SdrObject&, const ScDrawObjData 
&rAnchor );
+// Updates rAnchor based on position of rObj
+static void GetCellAnchorFromPosition( SdrObject &rObj, 
ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab );
 static void SetCellAnchoredFromPosition( SdrObject &rObj, 
const ScDocument &rDoc, SCTAB nTab );
  

[Libreoffice-commits] .: sc/inc sc/source

2012-11-11 Thread Libreoffice Gerrit user
 sc/inc/conditio.hxx|6 ++
 sc/source/core/data/conditio.cxx   |   20 
 sc/source/filter/xml/xmlcondformat.cxx |   11 +++
 sc/source/filter/xml/xmlcondformat.hxx |2 ++
 4 files changed, 35 insertions(+), 4 deletions(-)

New commits:
commit eb240530443b964ea45bf80a5e3711e11a3f09c5
Author: Markus Mohrhard 
Date:   Mon Nov 12 07:16:05 2012 +0100

remove conditional formats withiout range after import, related fdo#56983

Change-Id: I9a8c02369c3e5a12310a46229bdc1671f75593ad

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index afcfd01..d60da24 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -409,6 +409,12 @@ public:
 
 voidInsertNew( ScConditionalFormat* pNew )
 { maConditionalFormats.insert(pNew); }
+/**
+ * Checks that all cond formats have a non empty range.
+ * Deletes empty cond formats.
+ * @return true if all cond formats were valid
+ */
+boolCheckAllEntries();
 
 ScConditionalFormat* GetFormat( sal_uInt32 nKey );
 
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index f164cc4..ecece73 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1975,20 +1975,32 @@ void ScConditionalFormatList::UpdateMoveTab( SCTAB 
nOldPos, SCTAB nNewPos )
 itr->UpdateMoveTab( nOldPos, nNewPos );
 }
 
-void ScConditionalFormatList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2 )
+bool ScConditionalFormatList::CheckAllEntries()
 {
-for( iterator itr = begin(); itr != end(); ++itr)
-itr->DeleteArea( nCol1, nRow1, nCol2, nRow2 );
-
+bool bValid = true;
+//
 // need to check which must be deleted
 iterator itr = begin();
 while(itr != end())
 {
 if(itr->GetRange().empty())
+{
+bValid = false;
 maConditionalFormats.erase(itr++);
+}
 else
 ++itr;
 }
+
+return bValid;
+}
+
+void ScConditionalFormatList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2 )
+{
+for( iterator itr = begin(); itr != end(); ++itr)
+itr->DeleteArea( nCol1, nRow1, nCol2, nRow2 );
+
+CheckAllEntries();
 }
 
 void ScConditionalFormatList::SourceChanged( const ScAddress& rAddr )
diff --git a/sc/source/filter/xml/xmlcondformat.cxx 
b/sc/source/filter/xml/xmlcondformat.cxx
index 5c9bbe4..8b97a78 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -65,6 +65,17 @@ SvXMLImportContext* 
ScXMLConditionalFormatsContext::CreateChildContext( sal_uInt
 return pContext;
 }
 
+void ScXMLConditionalFormatsContext::EndElement()
+{
+ScDocument* pDoc = GetScImport().GetDocument();
+
+SCTAB nTab = GetScImport().GetTables().GetCurrentSheet();
+ScConditionalFormatList* pCondFormatList = pDoc->GetCondFormList(nTab);
+bool bDeleted = !pCondFormatList->CheckAllEntries();
+
+SAL_WARN_IF(bDeleted, "sc", "conditional formats have been deleted because 
they contained empty range info");
+}
+
 ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& 
rImport, sal_uInt16 nPrfx,
 const ::rtl::OUString& rLName, const 
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& 
xAttrList):
 SvXMLImportContext( rImport, nPrfx, rLName )
diff --git a/sc/source/filter/xml/xmlcondformat.hxx 
b/sc/source/filter/xml/xmlcondformat.hxx
index 45513ce..0ace1eb 100644
--- a/sc/source/filter/xml/xmlcondformat.hxx
+++ b/sc/source/filter/xml/xmlcondformat.hxx
@@ -51,6 +51,8 @@ public:
  const ::rtl::OUString& rLocalName,
  const ::com::sun::star::uno::Reference<
   
::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+virtual void EndElement();
 };
 
 class ScXMLConditionalFormatContext : public SvXMLImportContext
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source unusedcode.easy

2012-10-27 Thread Libreoffice Gerrit user
 sc/inc/attrib.hxx   |1 
 sc/source/core/data/attrib.cxx  |6 -
 sc/source/filter/excel/xltoolbar.cxx|4 ---
 sc/source/filter/excel/xltoolbar.hxx|1 
 sc/source/ui/condformat/colorformat.cxx |   33 
 sc/source/ui/inc/colorformat.hxx|1 
 unusedcode.easy |3 --
 7 files changed, 49 deletions(-)

New commits:
commit 7b633213c0d814d0fd485a6070291944e9890cee
Author: Matúš Kukan 
Date:   Fri Oct 26 16:33:35 2012 +0200

unusedcode: sc: unused ctors

Change-Id: Iaa082d85ef95c58da14013c80cb06a2e1112d4ef

diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index eb051fd..af401d1 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -399,7 +399,6 @@ public:
 TYPEINFO();
 
 explicit ScCondFormatItem();
-explicit ScCondFormatItem(sal_uInt32 nIndex);
 explicit ScCondFormatItem(const std::vector& nIndex);
 
 virtual ~ScCondFormatItem();
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 6a29e52..d666229 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -1228,12 +1228,6 @@ ScCondFormatItem::ScCondFormatItem():
 {
 }
 
-ScCondFormatItem::ScCondFormatItem( sal_uInt32 nIndex ):
-SfxPoolItem( ATTR_CONDITIONAL )
-{
-maIndex.push_back(nIndex);
-}
-
 ScCondFormatItem::ScCondFormatItem( const std::vector& rIndex ):
 SfxPoolItem( ATTR_CONDITIONAL ),
 maIndex( rIndex )
diff --git a/sc/source/filter/excel/xltoolbar.cxx 
b/sc/source/filter/excel/xltoolbar.cxx
index f582ab8..2bb994e 100644
--- a/sc/source/filter/excel/xltoolbar.cxx
+++ b/sc/source/filter/excel/xltoolbar.cxx
@@ -94,10 +94,6 @@ CTBS::CTBS() : bSignature(0), bVersion(0), reserved1(0), 
reserved2(0), reserved3
 {
 }
 
-ScCTB::ScCTB() : nViews( 0 ), ectbid(0)
-{
-}
-
 ScCTB::ScCTB(sal_uInt16 nNum ) : nViews( nNum ), ectbid(0)
 {
 }
diff --git a/sc/source/filter/excel/xltoolbar.hxx 
b/sc/source/filter/excel/xltoolbar.hxx
index cc97943..ed598d5 100644
--- a/sc/source/filter/excel/xltoolbar.hxx
+++ b/sc/source/filter/excel/xltoolbar.hxx
@@ -74,7 +74,6 @@ class ScCTB : public TBBase
 std::vector< ScTBC > rTBC;
 bool ImportCustomToolBar_Impl( ScCTBWrapper&, CustomToolBarImportHelper& );
 public:
-ScCTB();
 ScCTB(sal_uInt16);
 ~ScCTB(){}
 void Print( FILE* );
diff --git a/sc/source/ui/condformat/colorformat.cxx 
b/sc/source/ui/condformat/colorformat.cxx
index 7983591..8d77b8a 100644
--- a/sc/source/ui/condformat/colorformat.cxx
+++ b/sc/source/ui/condformat/colorformat.cxx
@@ -36,39 +36,6 @@
 #include 
 #include 
 
-ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, ScDocument* pDoc, 
const ScAddress& rPos):
-ModalDialog( pWindow, ScResId( RID_SCDLG_DATABAR ) ),
-maBtnOk( this, ScResId( BTN_OK ) ),
-maBtnCancel( this, ScResId( BTN_CANCEL ) ),
-maFlBarColors( this, ScResId( FL_BAR_COLORS ) ),
-maFlAxes( this, ScResId( FL_AXIS ) ),
-maFlValues( this, ScResId( FL_VALUES ) ),
-maFtMin( this, ScResId( FT_MINIMUM ) ),
-maFtMax( this, ScResId( FT_MAXIMUM ) ),
-maFtPositive( this, ScResId( FT_POSITIVE ) ),
-maFtNegative( this, ScResId( FT_NEGATIVE ) ),
-maFtPosition( this, ScResId( FT_POSITION ) ),
-maFtAxisColor( this, ScResId( FT_COLOR_AXIS ) ),
-maLbPos( this, ScResId( LB_POS ) ),
-maLbNeg( this, ScResId( LB_NEG ) ),
-maLbAxisCol( this, ScResId( LB_COL_AXIS ) ),
-maLbTypeMin( this, ScResId( LB_TYPE ) ),
-maLbTypeMax( this, ScResId( LB_TYPE ) ),
-maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ),
-maEdMin( this, ScResId( ED_MIN ) ),
-maEdMax( this, ScResId( ED_MAX ) ),
-mpNumberFormatter( pDoc->GetFormatTable() ),
-mpDoc(pDoc),
-maPos(rPos)
-{
-Init();
-FreeResource();
-
-maLbTypeMin.SelectEntryPos(0);
-maLbTypeMax.SelectEntryPos(0);
-maLbAxisPos.SelectEntryPos(0);
-}
-
 namespace {
 
 void SetType(const ScColorScaleEntry* pEntry, ListBox& rLstBox)
diff --git a/sc/source/ui/inc/colorformat.hxx b/sc/source/ui/inc/colorformat.hxx
index 3c58131..13bb74b 100644
--- a/sc/source/ui/inc/colorformat.hxx
+++ b/sc/source/ui/inc/colorformat.hxx
@@ -75,7 +75,6 @@ private:
 void Init();
 
 public:
-ScDataBarSettingsDlg(Window* pParent, ScDocument* pDoc, const ScAddress& 
rPos);
 ScDataBarSettingsDlg(Window* pParent, const ScDataBarFormatData& rData, 
ScDocument* pDoc, const ScAddress& rPos);
 
 ScDataBarFormatData* GetData();
diff --git a/unusedcode.easy b/unusedcode.easy
index 9d9d3a6..6c09c56 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -1,10 +1,7 @@
 FontSelectPattern::FontSelectPattern(PhysicalFontFace const&, Size const&, 
float, int, bool)
 RelatedMultipart::getIds()
 SanExtensionImpl::setCertExtn(unsigned char*, unsigned int, unsigned char*, 
unsigned int, unsigned char)
-ScCTB::ScCTB()
-ScCondFormatItem::ScCondFormatItem(unsigned int)
 ScConditionalFormat::dumpInfo(rtl::OUStringBuffer

[Libreoffice-commits] .: sc/inc sc/source

2012-10-10 Thread Libreoffice Gerrit user
 sc/inc/document.hxx  |5 -
 sc/source/core/data/documen2.cxx |1 -
 2 files changed, 6 deletions(-)

New commits:
commit 4266d4e9489ecf16ed336a1498cc9e81d9b3ab1f
Author: Kohei Yoshida 
Date:   Wed Oct 10 12:11:53 2012 -0400

Remove a flag that nobody uses.

Change-Id: Ia18640961e43de28ee08b43358483029db966987

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f02f028..390002e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -358,9 +358,6 @@ private:
 
 boolbIsEmbedded;// display/adjust 
Embedded area?
 
-// no SetDirty for ScFormulaCell::CompileTokenArray but at the end of
-// ScDocument::CompileAll[WithFormats], CopyScenario, CopyBlockFromClip
-boolbNoSetDirty;
 // no broadcast, construct no listener during insert from a different
 // Doc (per filter or the like ), not until CompileAll / CalcAfterLoad
 boolbInsertingFromOtherDoc;
@@ -1550,8 +1547,6 @@ public:
 SC_DLLPUBLIC sal_uInt32  GetRangeOverflowType() const{ 
return nRangeOverflowType; }
 
 // for broadcasting/listening
-voidSetNoSetDirty( bool bVal ) { bNoSetDirty = bVal; }
-boolGetNoSetDirty() const { return bNoSetDirty; }
 voidSetInsertingFromOtherDoc( bool bVal ) { 
bInsertingFromOtherDoc = bVal; }
 boolIsInsertingFromOtherDoc() const { return 
bInsertingFromOtherDoc; }
 voidSetLoadingMedium( bool bVal );
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 526655b..c0e9466 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -184,7 +184,6 @@ ScDocument::ScDocument( ScDocumentMode  eMode,
 bIsUndo( eMode == SCDOCMODE_UNDO ),
 bIsVisible( false ),
 bIsEmbedded( false ),
-bNoSetDirty( false ),
 bInsertingFromOtherDoc( false ),
 bLoadingMedium( false ),
 bImportingXML( false ),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-10-02 Thread Libreoffice Gerrit user
 sc/inc/colorscale.hxx  |   16 ++
 sc/source/core/data/colorscale.cxx |  206 +
 2 files changed, 88 insertions(+), 134 deletions(-)

New commits:
commit dde7ff4da28e754c2542191f363d8de78388e75a
Author: Markus Mohrhard 
Date:   Tue Oct 2 18:15:38 2012 +0200

simplify and speed up color format rendering

Change-Id: I7f9abc1e20ffb7d49ebae0c0f9d5e50f91b074c0

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index df3e17a..146c10b 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -189,10 +189,24 @@ public:
 virtual void DataChanged(const ScRange& rRange) = 0;
 virtual void SetParent(ScConditionalFormat* pParent);
 
+virtual void startRendering();
+virtual void endRendering();
+
 protected:
-void getValues( std::vector& rValues ) const;
+std::vector& getValues() const;
+
+double getMinValue() const;
+double getMaxValue() const;
 
 ScConditionalFormat* mpParent;
+
+private:
+
+struct ScColorFormatCache
+{
+std::vector maValues;
+};
+mutable boost::scoped_ptr mpCache;
 };
 
 class SC_DLLPUBLIC ScColorScaleFormat : public ScColorFormat
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index b224b51..6951e8b 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -34,6 +34,8 @@
 #include 
 #endif
 
+#include 
+
 ScColorScaleEntry::ScColorScaleEntry():
 mnVal(0),
 mpCell(NULL),
@@ -239,103 +241,6 @@ ScColorScaleEntryType ScColorScaleEntry::GetType() const
 return meType;
 }
 
-namespace {
-
-double getMinValue(const ScRange& rRange, ScDocument* pDoc)
-{
-double aMinValue = std::numeric_limits::max();
-//iterate through columns
-SCTAB nTab = rRange.aStart.Tab();
-for(SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol)
-{
-for(SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); 
++nRow)
-{
-ScAddress aAddr(nCol, nRow, rRange.aStart.Tab());
-CellType eType = pDoc->GetCellType(aAddr);
-if(eType == CELLTYPE_VALUE)
-{
-double aVal = pDoc->GetValue(nCol, nRow, nTab);
-if( aVal < aMinValue )
-aMinValue = aVal;
-}
-else if(eType == CELLTYPE_FORMULA)
-{
-
if(static_cast(pDoc->GetCell(aAddr))->IsValue())
-{
-double aVal = pDoc->GetValue(nCol, nRow, nTab);
-if( aVal < aMinValue )
-aMinValue = aVal;
-}
-}
-}
-}
-return aMinValue;
-}
-
-double getMaxValue(const ScRange& rRange, ScDocument* pDoc)
-{
-double aMaxValue = std::numeric_limits::min();
-//iterate through columns
-SCTAB nTab = rRange.aStart.Tab();
-for(SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol)
-{
-for(SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); 
++nRow)
-{
-ScAddress aAddr(nCol, nRow, rRange.aStart.Tab());
-CellType eType = pDoc->GetCellType(aAddr);
-if(eType == CELLTYPE_VALUE)
-{
-double aVal = pDoc->GetValue(nCol, nRow, nTab);
-if( aVal > aMaxValue )
-aMaxValue = aVal;
-}
-else if(eType == CELLTYPE_FORMULA)
-{
-
if(static_cast(pDoc->GetCell(aAddr))->IsValue())
-{
-double aVal = pDoc->GetValue(nCol, nRow, nTab);
-if( aVal > aMaxValue )
-aMaxValue = aVal;
-}
-}
-}
-}
-return aMaxValue;
-}
-
-double getMinValue(const ScRangeList& rList, ScDocument* pDoc)
-{
-double aMinValue = std::numeric_limits::max();
-
-size_t n = rList.size();
-for(size_t i = 0; i < n; ++i)
-{
-const ScRange* pRange = rList[i];
-double aVal = getMinValue(*pRange, pDoc);
-if( aVal < aMinValue )
-aMinValue = aVal;
-}
-return aMinValue;
-}
-
-double getMaxValue(const ScRangeList& rList, ScDocument* pDoc)
-{
-double aMaxVal = std::numeric_limits::min();
-
-size_t n = rList.size();
-for(size_t i = 0; i < n; ++i)
-{
-const ScRange* pRange = rList[i];
-double aVal = getMaxValue(*pRange, pDoc);
-if( aVal > aMaxVal )
-aMaxVal = aVal;
-}
-
-return aMaxVal;
-}
-
-}
-
 double ScColorScaleFormat::GetMinValue() const
 {
 const_iterator itr = maColorScales.begin();
@@ -344,7 +249,7 @@ double ScColorScaleFormat::GetMinValue() const
 return itr->GetValue();
 else
 {
-return getMinValue(GetRange(), mpDoc);
+return getMinValue();
 }
 }
 
@@ -356,7 +261,7 @@ double ScColorScaleFormat::GetMaxValue() const
 return itr->GetValue();
 else
 {
-   

[Libreoffice-commits] .: sc/inc sc/source

2012-09-24 Thread Libreoffice Gerrit user
 sc/inc/conditio.hxx  |   41 +
 sc/source/core/data/conditio.cxx |  168 +--
 sc/source/core/data/fillinfo.cxx |5 +
 3 files changed, 171 insertions(+), 43 deletions(-)

New commits:
commit af0c93da33f2bf39a673c2dc29fb44b90322d137
Author: Markus Mohrhard 
Date:   Mon Sep 24 23:19:41 2012 +0200

kill O(N^2) algorithm generating cond format render information, fdo#54396

Change-Id: I63536625eaf9b73c8e63d3cf88b6b798a6bf017b

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 7b1cf17..ae16d6b 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -35,8 +35,11 @@
 #include "scdllapi.h"
 #include "rangelst.hxx"
 
+#include 
+
 #include 
 #include 
+#include 
 
 class ScBaseCell;
 class ScFormulaCell;
@@ -116,11 +119,26 @@ public:
 #if DUMP_FORMAT_INFO
 virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const = 0;
 #endif
+
+virtual void startRendering();
+virtual void endRendering();
 protected:
 ScDocument* mpDoc;
 
 };
 
+class approx_less : public std::binary_function
+{
+public:
+bool operator() (double nVal1, double nVal2)
+{
+if(nVal1 < nVal2 && !rtl::math::approxEqual(nVal1, nVal2))
+return true;
+
+return false;
+}
+};
+
 class SC_DLLPUBLIC ScConditionEntry : public ScFormatEntry
 {
 // stored data:
@@ -216,10 +234,27 @@ public:
 virtual void dumpInfo(rtl::OUStringBuffer& ) const {}
 #endif
 
+virtual void endRendering();
+virtual void startRendering();
+
 protected:
 virtual voidDataChanged( const ScRange* pModified ) const;
 ScDocument* GetDocument() const { return mpDoc; }
 ScConditionalFormat*pCondFormat;
+
+private:
+
+bool IsDuplicate(double nArg, const rtl::OUString& rStr, const ScAddress& 
rAddr, const ScRangeList& rRanges) const;
+
+struct ScConditionEntryCache
+{
+typedef std::map StringCacheType;
+StringCacheType maStrings;
+typedef std::map ValueCacheType;
+ValueCacheType maValues;
+};
+
+mutable boost::scoped_ptr mpCache;
 };
 
 //
@@ -326,6 +361,9 @@ public:
 //  operator== only for sorting
 bool operator ==( const ScConditionalFormat& r ) const  { return nKey == 
r.nKey; }
 bool operator < ( const ScConditionalFormat& r ) const  { return nKey <  
r.nKey; }
+
+void startRendering();
+void endRendering();
 };
 
 //
@@ -371,6 +409,9 @@ public:
 size_t size() const;
 
 void erase(sal_uLong nIndex);
+
+void startRendering();
+void endRendering();
 };
 
 // see 
http://www.boost.org/doc/libs/1_49_0/libs/ptr_container/doc/tutorial.html#cloneability
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index c8e2dbc..f7b6b86 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -72,6 +72,14 @@ bool ScFormatEntry::operator==( const ScFormatEntry& r ) 
const
 }
 }
 
+void ScFormatEntry::startRendering()
+{
+}
+
+void ScFormatEntry::endRendering()
+{
+}
+
 bool lcl_HasRelRef( ScDocument* pDoc, ScTokenArray* pFormula, sal_uInt16 
nRecursion = 0 )
 {
 if (pFormula)
@@ -716,7 +724,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
 bFirstRun = false;
 }
 
-static bool lcl_GetCellContent( ScBaseCell* pCell, bool bIsStr1, double& rArg, 
String& rArgStr )
+static bool lcl_GetCellContent( ScBaseCell* pCell, bool bIsStr1, double& rArg, 
rtl::OUString& rArgStr )
 {
 bool bVal = true;
 
@@ -760,53 +768,84 @@ static bool lcl_GetCellContent( ScBaseCell* pCell, bool 
bIsStr1, double& rArg, S
 return bVal;
 }
 
-static bool lcl_IsDuplicate( ScDocument *pDoc, double nArg, const String& 
rStr, const ScAddress& rAddr, const ScRangeList& rRanges )
+bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, 
const ScAddress& rAddr, const ScRangeList& rRanges ) const
 {
-size_t nListCount = rRanges.size();
-for( size_t i = 0; i < nListCount; i++ )
+if(!mpCache)
 {
-const ScRange *aRange = rRanges[i];
-SCROW nRow = aRange->aEnd.Row();
-SCCOL nCol = aRange->aEnd.Col();
-SCCOL nColStart = aRange->aStart.Col();
-SCROW nRowStart = aRange->aEnd.Row();
-SCTAB nTab = aRange->aStart.Tab();
-
-// temporary fix to workaorund slow duplicate entry
-// conditions, prevent to use a whole row
-if(nRow == MAXROW)
+mpCache.reset(new ScConditionEntryCache);
+size_t nListCount = rRanges.size();
+for( size_t i = 0; i < nListCount; i++ )
 {
-bool bShrunk = false;
-pDoc->ShrinkToUsedDataArea(bShrunk, nTab, nColStart, nRowStart,
-nCol, nRow, false);
-}
-
-for( SCROW r = nRowStart; r <= nRow; r++ )
-for( SCCOL c = nColStart; c <= nCol; c++ )
+const ScRange *aRange = rRanges[i];
+SCROW nRow = aRang

[Libreoffice-commits] .: sc/inc sc/source

2012-09-24 Thread Libreoffice Gerrit user
 sc/inc/document.hxx   |2 +-
 sc/source/filter/inc/stylesbuffer.hxx |5 -
 sc/source/filter/oox/stylesbuffer.cxx |   28 
 3 files changed, 29 insertions(+), 6 deletions(-)

New commits:
commit 72d3539e26f0485743126301c438bcb05b02643d
Author: Noel Power 
Date:   Mon Sep 24 09:57:57 2012 +0100

fix parent style import xlsx fdo#55198

Change-Id: I77d38eba69ad7aa89b0f9b692e40fd365d002071

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index b12ce26..da7b575 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1230,7 +1230,7 @@ public:
 SCCOL nEndCol, SCROW nEndRow, SCTAB 
nTab,
 const ScStyleSheet& rStyle);
 
-voidApplySelectionStyle( const ScStyleSheet& rStyle, const 
ScMarkData& rMark );
+SC_DLLPUBLIC voidApplySelectionStyle( const ScStyleSheet& 
rStyle, const ScMarkData& rMark );
 voidApplySelectionLineStyle( const ScMarkData& rMark,
 const ::editeng::SvxBorderLine* 
pLine, bool bColorOnly );
 
diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index 5257f04..43b22a9 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -831,7 +831,7 @@ public:
 inline const CellStyleModel& getModel() const { return maModel; }
 /** Returns the final style name used in the document. */
 inline const ::rtl::OUString& getFinalStyleName() const { return 
maFinalName; }
-
+inline ::ScStyleSheet* getStyleSheet() { return mpStyleSheet; }
 private:
 CellStyleModel  maModel;
 ::rtl::OUString maFinalName;/// Final style name used in API.
@@ -863,12 +863,14 @@ public:
 ::rtl::OUString getDefaultStyleName() const;
 /** Creates the style sheet described by the style XF with the passed 
identifier. */
 ::rtl::OUString createCellStyle( sal_Int32 nXfId ) const;
+::ScStyleSheet* getCellStyleSheet( sal_Int32 nXfId ) const;
 
 private:
 /** Inserts the passed cell style object into the internal maps. */
 voidinsertCellStyle( CellStyleRef xCellStyle );
 /** Creates the style sheet described by the passed cell style object. */
 ::rtl::OUString createCellStyle( const CellStyleRef& rxCellStyle ) 
const;
+::ScStyleSheet* getCellStyleSheet( const CellStyleRef& rxCellStyle ) 
const;
 
 private:
 typedef RefVector< CellStyle >  CellStyleVector;
@@ -967,6 +969,7 @@ public:
 ::rtl::OUString getDefaultStyleName() const;
 /** Creates the style sheet described by the style XF with the passed 
identifier. */
 ::rtl::OUString createCellStyle( sal_Int32 nXfId ) const;
+::ScStyleSheet* getCellStyleSheet( sal_Int32 nXfId ) const;
 /** Creates the style sheet described by the DXF with the passed 
identifier. */
 ::rtl::OUString createDxfStyle( sal_Int32 nDxfId ) const;
 
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 1ac390a..cb1ce6e 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2260,10 +2260,13 @@ void Xf::writeToMarkData( ::ScMarkData& rMarkData, 
sal_Int32 nNumFmtId  )
 ScDocument& rDoc = getScDocument();
 if ( isCellXf() )
 {
+StylesBuffer& rStyles = getStyles();
+rStyles.createCellStyle( maModel.mnStyleXfId );
+
+mpStyleSheet = rStyles.getCellStyleSheet( maModel.mnStyleXfId );
 if ( mpStyleSheet )
 {
-// Apply style sheet.  Don't clear the direct formats.
-rPat.SetStyleSheet(mpStyleSheet, false);
+rDoc.ApplySelectionStyle( 
static_cast(*mpStyleSheet), rMarkData );
 }
 else
 {
@@ -2275,7 +2278,7 @@ void Xf::writeToMarkData( ::ScMarkData& rMarkData, 
sal_Int32 nNumFmtId  )
 ScGlobal::GetRscString(STR_STYLENAME_STANDARD), 
SFX_STYLE_FAMILY_PARA));
 
 if (pStyleSheet)
-rPat.SetStyleSheet(pStyleSheet, false);
+rDoc.ApplySelectionStyle( 
static_cast(*pStyleSheet), rMarkData );
 }
 }
 }
@@ -2329,7 +2332,6 @@ Xf::createPattern( bool bSkipPoolDefs )
 {
 if( mpPattern.get() )
 return *mpPattern;
-// create new pattern attribute set
 mpPattern.reset( new ::ScPatternAttr( getScDocument().GetPool() ) );
 SfxItemSet& rItemSet = mpPattern->GetItemSet();
 /*  Enables the used flags, if the formatting attributes differ from the
@@ -2858,6 +2860,11 @@ OUString CellStyleBuffer::createCellStyle( sal_Int32 
nXfId ) const
 return createCellStyle( maStylesByXf.get( nXfId ) );
 }
 
+::ScStyleSheet*   CellStyleBuffer::getCellStyleSheet( sal_Int32 nXfId ) const
+{
+return getCellStyleSheet( maStylesByXf.get( nXfId ) );
+}
+
 // private 

[Libreoffice-commits] .: sc/inc sc/source

2012-09-20 Thread Libreoffice Gerrit user
 sc/inc/rangenam.hxx |3 +-
 sc/source/core/tool/rangenam.cxx|   36 +---
 sc/source/filter/oox/defnamesbuffer.cxx |   13 +--
 3 files changed, 37 insertions(+), 15 deletions(-)

New commits:
commit 7539a695b801b92d10ff30463a8c08672a258442
Author: Noel Power 
Date:   Thu Sep 20 15:05:00 2012 +0100

xlsx fix cyclic referenced defined names partially fixes bnc#780296 
bnc#781166

Change-Id: Ibad37ac05c608c0211063bfa73931427d48c11f9

diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index d370328..64955e1 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -87,7 +87,7 @@ private:
 SCCOL   mnMaxCol;
 
 void CompileRangeData( const String& rSymbol, bool bSetError );
-
+void InitCode();
 public:
 typedef ::std::map IndexMap;
 
@@ -120,6 +120,7 @@ public:
 voidSetIndex( sal_uInt16 nInd ) { nIndex = nInd; }
 sal_uInt16GetIndex() const{ return nIndex; }
 ScTokenArray*   GetCode()   { return pCode; }
+SC_DLLPUBLIC void   SetCode( ScTokenArray& );
 const ScTokenArray* GetCode() const { return pCode; }
 SC_DLLPUBLIC sal_uInt16 GetErrCode() const;
 boolHasReferences() const;
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index a2f67a2..8a52a71 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -100,18 +100,7 @@ ScRangeData::ScRangeData( ScDocument* pDok,
 mnMaxRow(-1),
 mnMaxCol(-1)
 {
-if( !pCode->GetCodeError() )
-{
-pCode->Reset();
-FormulaToken* p = pCode->GetNextReference();
-if( p )   // exact one reference at first
-{
-if( p->GetType() == svSingleRef )
-eType = eType | RT_ABSPOS;
-else
-eType = eType | RT_ABSAREA;
-}
-}
+InitCode();
 }
 
 ScRangeData::ScRangeData( ScDocument* pDok,
@@ -648,6 +637,29 @@ void ScRangeData::ValidateTabRefs()
 }
 }
 
+void ScRangeData::SetCode( ScTokenArray& rArr )
+{
+::std::auto_ptr pOldCode( pCode); // old pCode will be 
deleted
+pCode = new ScTokenArray( rArr );
+InitCode();
+}
+
+void ScRangeData::InitCode()
+{
+if( !pCode->GetCodeError() )
+{
+pCode->Reset();
+FormulaToken* p = pCode->GetNextReference();
+if( p )   // exact one reference at first
+{
+if( p->GetType() == svSingleRef )
+eType = eType | RT_ABSPOS;
+else
+eType = eType | RT_ABSAREA;
+}
+}
+}
+
 
 extern "C"
 int SAL_CALL ScRangeData_QsortNameCompare( const void* p1, const void* p2 )
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx 
b/sc/source/filter/oox/defnamesbuffer.cxx
index b31b5fb..6a3a3aa 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -382,9 +382,9 @@ void DefinedName::createNameObject( sal_Int32 nIndex )
 
 // create the name and insert it into the document, maCalcName will be 
changed to the resulting name
 if (maModel.mnSheet >= 0)
-mpScRangeData = createLocalNamedRangeObject( maCalcName, getTokens(), 
nIndex, nNameFlags, maModel.mnSheet );
+mpScRangeData = createLocalNamedRangeObject( maCalcName, 
ApiTokenSequence(), nIndex, nNameFlags, maModel.mnSheet );
 else
-mpScRangeData = createNamedRangeObject( maCalcName, getTokens(), 
nIndex, nNameFlags );
+mpScRangeData = createNamedRangeObject( maCalcName, 
ApiTokenSequence(), nIndex, nNameFlags );
 mnTokenIndex = nIndex;
 }
 
@@ -426,6 +426,15 @@ DefinedName::getTokens()
 
 void DefinedName::convertFormula()
 {
+// convert and set formula of the defined name
+if ( getFilterType() == FILTER_OOXML )
+{
+ApiTokenSequence aTokens = getTokens();
+ScTokenArray aTokenArray;
+(void)ScTokenConversion::ConvertToTokenArray( this->getScDocument(), 
aTokenArray, aTokens );
+mpScRangeData->SetCode( aTokenArray );
+}
+
 ScTokenArray* pTokenArray = mpScRangeData->GetCode();
 Sequence< FormulaToken > aFTokenSeq;
 (void)ScTokenConversion::ConvertToTokenSequence( this->getScDocument(), 
aFTokenSeq, *pTokenArray );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-09-18 Thread Libreoffice Gerrit user
 sc/inc/dpcachetable.hxx  |8 
 sc/source/core/data/dpcachetable.cxx |   11 ---
 sc/source/core/data/dpitemdata.cxx   |2 +-
 3 files changed, 1 insertion(+), 20 deletions(-)

New commits:
commit c72af8739d57035b9cd0771941939bd77813348e
Author: Kohei Yoshida 
Date:   Tue Sep 18 15:53:21 2012 -0400

Some cleanups.

Change-Id: I8812c9928409bcdb78dac1479c5e2205f2616965

diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index c0d0625..c55ec26 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -55,15 +55,7 @@ struct ScQueryParam;
  */
 class SC_DLLPUBLIC ScDPCacheTable
 {
-struct RowFlag
-{
-bool mbShowByFilter:1;
-bool mbShowByPage:1;
-bool isActive() const;
-RowFlag();
-};
 public:
-
 /** interface class used for filtering of rows. */
 class FilterBase
 {
diff --git a/sc/source/core/data/dpcachetable.cxx 
b/sc/source/core/data/dpcachetable.cxx
index 11ac85f..14f4e8e 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -64,17 +64,6 @@ using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::UNO_QUERY_THROW;
 using ::com::sun::star::sheet::DataPilotFieldFilter;
 
-bool ScDPCacheTable::RowFlag::isActive() const
-{
-return mbShowByFilter && mbShowByPage;
-}
-
-ScDPCacheTable::RowFlag::RowFlag() :
-mbShowByFilter(false),
-mbShowByPage(true)
-{
-}
-
 ScDPCacheTable::SingleFilter::SingleFilter(const ScDPItemData& rItem) :
 maItem(rItem) {}
 
diff --git a/sc/source/core/data/dpitemdata.cxx 
b/sc/source/core/data/dpitemdata.cxx
index bb22894..c3a163c 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -210,7 +210,7 @@ bool ScDPItemData::IsCaseInsEqual(const ScDPItemData& r) 
const
 ;
 }
 
-if (mbStringInterned && r.mbStringInterned && mpString == r.mpString)
+if (mpString == r.mpString)
 // Fast equality check for interned strings.
 return true;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: [Libreoffice-commits] .: sc/inc sc/source

2012-09-06 Thread Stephan Bergmann

On 09/06/2012 03:52 PM, Markus Mohrhard wrote:

2012/9/6 Stephan Bergmann :

On 09/05/2012 05:57 PM, Libreoffice Gerrit user wrote:

+pContext = pContext;



Should that rather be pContext = pMapContext?



Yes, changed in master. Can someone please backport it to 3-6.


Done.

Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice-commits] .: sc/inc sc/source

2012-09-06 Thread Stephan Bergmann

On 09/05/2012 05:57 PM, Libreoffice Gerrit user wrote:

commit bedbb471c3f49e0860dd63b17c1faeee837096ae
Author: Markus Mohrhard 
Date:   Mon Sep 3 19:30:26 2012 +0200

 better import of conditional format from old ODF structure

 The old ODF storage is style based and so the sam cond format can be
 divided up into several single stlyes which resulted in several new
 style cond formats.

 Now we check for old stlye cond formats if there is a equal cond format
 and in this case just extend the area. This should make it easier to
 transform old documents into the new range based cond formats.

 Change-Id: I51a5148922e19e6860de9915abfc59d49b18d96e

diff --git a/sc/source/filter/xml/xmlstyli.cxx 
b/sc/source/filter/xml/xmlstyli.cxx
index 1ef7cda..5776d72 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -492,13 +408,11 @@ SvXMLImportContext 
*XMLTableStyleContext::CreateChildContext(
  if( (XML_NAMESPACE_STYLE == nPrefix) &&
  IsXMLToken(rLocalName, XML_MAP ) )
  {
-pContext = new ScXMLMapContext(GetImport(), nPrefix, rLocalName, 
xAttrList);
-
-ScXMLMapContent aMap;
-aMap.sCondition = ((ScXMLMapContext*)pContext)->GetCondition();
-aMap.sApplyStyle = ((ScXMLMapContext*)pContext)->GetApplyStyle();
-aMap.sBaseCell = ((ScXMLMapContext*)pContext)->GetBaseCell();
-aMaps.push_back(aMap);
+if(!mpCondFormat)
+mpCondFormat = new ScConditionalFormat( 0, 
GetScImport().GetDocument() );
+ScXMLMapContext* pMapContext = new ScXMLMapContext(GetImport(), 
nPrefix, rLocalName, xAttrList);
+pContext = pContext;


Should that rather be pContext = pMapContext?

Stephan


+mpCondFormat->AddEntry(pMapContext->CreateConditionEntry());
  }
  if (!pContext)
  pContext = XMLPropStyleContext::CreateChildContext( nPrefix, 
rLocalName,


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] .: sc/inc sc/source

2012-09-05 Thread Libreoffice Gerrit user
 sc/inc/conditio.hxx   |4 
 sc/source/core/data/conditio.cxx  |   34 +++-
 sc/source/filter/xml/xmlimprt.cxx |2 
 sc/source/filter/xml/xmlimprt.hxx |1 
 sc/source/filter/xml/xmlstyli.cxx |  259 --
 sc/source/filter/xml/xmlstyli.hxx |   32 +---
 6 files changed, 151 insertions(+), 181 deletions(-)

New commits:
commit bedbb471c3f49e0860dd63b17c1faeee837096ae
Author: Markus Mohrhard 
Date:   Mon Sep 3 19:30:26 2012 +0200

better import of conditional format from old ODF structure

The old ODF storage is style based and so the sam cond format can be
divided up into several single stlyes which resulted in several new
style cond formats.

Now we check for old stlye cond formats if there is a equal cond format
and in this case just extend the area. This should make it easier to
transform old documents into the new range based cond formats.

Change-Id: I51a5148922e19e6860de9915abfc59d49b18d96e

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 9890758..b4f686e 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -111,6 +111,8 @@ public:
 
 virtual void SetParent( ScConditionalFormat* pNew ) = 0;
 
+bool operator==( const ScFormatEntry& ) const;
+
 #if DUMP_FORMAT_INFO
 virtual void dumpInfo() const = 0;
 #endif
@@ -282,6 +284,8 @@ public:
 voidAddEntry( ScFormatEntry* pNew );
 voidAddRange( const ScRangeList& rRanges );
 const ScRangeList&  GetRange() const  { return maRanges; }
+// don't use the same name as for the const version
+ScRangeList& GetRangeList() { return maRanges; }
 
 bool IsEmpty() const { return maEntries.empty(); }
 size_t size() const   { return maEntries.size(); }
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 17483c3..5a0c483 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -54,6 +54,27 @@ ScFormatEntry::ScFormatEntry(ScDocument* pDoc):
 {
 }
 
+bool ScFormatEntry::operator==( const ScFormatEntry& r ) const
+{
+if(GetType() != r.GetType())
+return false;
+
+switch(GetType())
+{
+case condformat::CONDITION:
+return static_cast(*this) == 
static_cast(r);
+break;
+default:
+// TODO: implement also this case
+// actually return false for these cases is not that bad
+// as soon as databar and color scale are tested we need
+// to think about the range
+return false;
+}
+
+return true;
+}
+
 bool lcl_HasRelRef( ScDocument* pDoc, ScTokenArray* pFormula, sal_uInt16 
nRecursion = 0 )
 {
 if (pFormula)
@@ -1286,8 +1307,6 @@ int ScCondFormatEntry::operator== ( const 
ScCondFormatEntry& r ) const
 {
 return ScConditionEntry::operator==( r ) &&
 aStyleName == r.aStyleName;
-
-//  Range wird nicht verglichen
 }
 
 ScCondFormatEntry::~ScCondFormatEntry()
@@ -1353,13 +1372,14 @@ bool ScConditionalFormat::EqualEntries( const 
ScConditionalFormat& r ) const
 
 //! auf gleiche Eintraege in anderer Reihenfolge testen ???
 
-/*
-for (sal_uInt16 i=0; iFillPropertySet(xProperties);
+// here needs to be the cond format import method
 sal_Int32 nNumberFormat(pStyle->GetNumberFormat());
 SetType(xProperties, nNumberFormat, nPrevCellType, 
sPrevCurrency);
 
 // store first cell of first range for each style, once per 
sheet
 uno::Sequence 
aAddresses(xSheetCellRanges->getRangeAddresses());
+pStyle->ApplyCondFormat(aAddresses);
 if ( aAddresses.getLength() > 0 )
 {
 const table::CellRangeAddress& rRange = aAddresses[0];
diff --git a/sc/source/filter/xml/xmlimprt.hxx 
b/sc/source/filter/xml/xmlimprt.hxx
index f3706d9..d9d86fc 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -852,6 +852,7 @@ class ScXMLImport: public SvXMLImport
 com::sun::star::uno::Reference  
xNumberFormats;
 com::sun::star::uno::Reference  
xNumberFormatTypes;
 
+ScRangeList maSheetRanges;
 com::sun::star::uno::Reference 
 xSheetCellRanges;
 
 rtl::OUString   sEmpty;
diff --git a/sc/source/filter/xml/xmlstyli.cxx 
b/sc/source/filter/xml/xmlstyli.cxx
index 1ef7cda..5776d72 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -52,6 +52,15 @@
 #include "docuno.hxx"
 #include "unonames.hxx"
 #include "document.hxx"
+#include "conditio.hxx"
+#include "svl/intitem.hxx"
+#include "rangelst.hxx"
+#include "rangeutl.hxx"
+#include "docfunc.hxx"
+#include "markdata.hxx"
+#include "docpool.hxx"
+#include "scitems.hxx"
+#include "patattr.hxx"
 
 #define XML_LINE_LEFT 0
 #define XML_LINE_RIGHT 1
@@ -279,9 +288,12 @@ void ScXMLRowImportPropertyMapper::finished(::std::vector< 
X

[Libreoffice-commits] .: sc/inc sc/source

2012-08-30 Thread Libreoffice Gerrit user
 sc/inc/dpobject.hxx|2 +-
 sc/source/core/data/dpobject.cxx   |9 +
 sc/source/ui/docshell/dbdocfun.cxx |3 ++-
 3 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 6ad86f8cc036d01702e9d491874b2b3bde23fe77
Author: Kohei Yoshida 
Date:   Thu Aug 30 10:45:27 2012 -0400

fdo#53938: Don't proceed when error occurs.

This prevents the same error dialog from appearing 3 times in a row,
also the pivot table outout from becoming empty.

Change-Id: I09a72f78561f3f0446a95732fb9c242c1144878a

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 06ad537..cba66cc 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -243,7 +243,7 @@ public:
  * Remove in the save data entries for members that don't exist anymore.
  * This is called during pivot table refresh.
  */
-void SyncAllDimensionMembers();
+bool SyncAllDimensionMembers();
 
 static bool HasRegisteredSources();
 static com::sun::star::uno::Sequence GetRegisteredSources();
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index af6ac2d..78b1e03 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -859,26 +859,27 @@ void ScDPObject::BuildAllDimensionMembers()
 pSaveData->BuildAllDimensionMembers(GetTableData());
 }
 
-void ScDPObject::SyncAllDimensionMembers()
+bool ScDPObject::SyncAllDimensionMembers()
 {
 if (!pSaveData)
-return;
+return false;
 
 // #i111857# don't always create empty mpTableData for external service.
 // Ideally, xSource should be used instead of mpTableData.
 if (pServDesc)
-return;
+return false;
 
 ScDPTableData* pData = GetTableData();
 if (!pData)
 // No table data exists.  This can happen when refreshing from an
 // external source which doesn't exist.
-return;
+return false;
 
 // Refresh the cache wrapper since the cache may have changed.
 pData->SetEmptyFlags(pSaveData->GetIgnoreEmptyRows(), 
pSaveData->GetRepeatIfEmpty());
 pData->ReloadCacheTable();
 pSaveData->SyncAllDimensionMembers(pData);
+return true;
 }
 
 bool ScDPObject::GetMemberNames( sal_Int32 nDim, Sequence& rNames )
diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index d7cff63..74674e6 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1470,7 +1470,8 @@ sal_uLong ScDBDocFunc::RefreshPivotTables(ScDPObject* 
pDPObj, bool bApi)
 for (; it != itEnd; ++it)
 {
 ScDPObject* pObj = *it;
-pObj->SyncAllDimensionMembers();
+if (!pObj->SyncAllDimensionMembers())
+continue;
 
 // This action is intentionally not undoable since it modifies cache.
 DataPilotUpdate(pObj, pObj, false, bApi);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-08-24 Thread Libreoffice Gerrit user
 sc/inc/cell.hxx   |4 ++--
 sc/inc/document.hxx   |6 --
 sc/source/core/data/cell.cxx  |   11 ++-
 sc/source/core/data/documen4.cxx  |5 +++--
 sc/source/core/data/documen7.cxx  |5 +++--
 sc/source/filter/xml/xmlsubti.cxx |2 +-
 sc/source/ui/docshell/docsh.cxx   |2 +-
 7 files changed, 20 insertions(+), 15 deletions(-)

New commits:
commit deaac6fffa883d5604a35eb0706c7526b87398cc
Author: Daniel Bankston 
Date:   Sat Jul 28 03:24:57 2012 -0500

Improve matrix import performance.

Our latest changes that recalculate volatile formulas at the end of import
resulted in several seconds performance loss on a large matrix test file
with complex formulas.

When the matrix cells are put in the document, ScFormulaCell::SetDirty()
gets called.  Although the cells are set clean during import after this,
SetDirty() also uses ScDocument::TrackFormulas() which puts the cells in
the formula tree.  So when we call ScDocument::DoRecalc() at the end of
import, the interpreter goes through all matrix cells because they are
in the formula tree.

This commit prevent that from happening, which gives us back our 
performance.

Change-Id: I961f69b0117d4261f8afefb6d94173105f0925b2

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index f609a46..79e99db 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -376,7 +376,7 @@ public:
 voidGetFormula( rtl::OUStringBuffer& rBuffer,
 const formula::FormulaGrammar::Grammar = 
formula::FormulaGrammar::GRAM_DEFAULT ) const;
 
-voidSetDirty();
+voidSetDirty( bool bDirtyFlag=true );
 voidSetDirtyVar();
 // If setting entire document dirty after load, no broadcasts but still 
append to FormulaTree.
 voidSetDirtyAfterLoad();
@@ -472,7 +472,7 @@ public:
 virtual voidNotify( SvtBroadcaster& rBC, const SfxHint& rHint);
 voidSetCompile( bool bVal ) { bCompile = bVal; }
 ScDocument* GetDocument() const { return pDocument; }
-voidSetMatColsRows( SCCOL nCols, SCROW nRows );
+voidSetMatColsRows( SCCOL nCols, SCROW nRows, bool 
bDirtyFlag=true );
 voidGetMatColsRows( SCCOL& nCols, SCROW& nRows ) const;
 
 // cell belongs to ChangeTrack and not to the real document
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ba23156..a2db35f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -770,7 +770,8 @@ public:
 const ScMarkData& rMark,
 const rtl::OUString& rFormula,
 const ScTokenArray* p = NULL,
-const formula::FormulaGrammar::Grammar 
= formula::FormulaGrammar::GRAM_DEFAULT );
+const formula::FormulaGrammar::Grammar 
= formula::FormulaGrammar::GRAM_DEFAULT,
+bool bDirtyFlag=true );
 SC_DLLPUBLIC void   InsertTableOp(const ScTabOpParam& rParam,   // 
multi-operation
   SCCOL nCol1, SCROW nRow1,
   SCCOL nCol2, SCROW nRow2, const ScMarkData& 
rMark);
@@ -1657,7 +1658,8 @@ public:
 voidPutInFormulaTree( ScFormulaCell* pCell );
 voidRemoveFromFormulaTree( ScFormulaCell* pCell );
 voidCalcFormulaTree( bool bOnlyForced = false,
-bool bNoProgressBar = false );
+ bool bNoProgressBar = false,
+ bool bDirtyFlag=true );
 voidClearFormulaTree();
 voidAppendToFormulaTrack( ScFormulaCell* pCell );
 voidRemoveFromFormulaTrack( ScFormulaCell* pCell );
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 4676cc8..8f3a0a4 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -1726,17 +1726,17 @@ void ScFormulaCell::InterpretTail( 
ScInterpretTailParameter eTailParam )
 }
 
 
-void ScFormulaCell::SetMatColsRows( SCCOL nCols, SCROW nRows )
+void ScFormulaCell::SetMatColsRows( SCCOL nCols, SCROW nRows, bool bDirtyFlag )
 {
 ScMatrixFormulaCellToken* pMat = 
aResult.GetMatrixFormulaCellTokenNonConst();
 if (pMat)
-pMat->SetMatColsRows( nCols, nRows);
+pMat->SetMatColsRows( nCols, nRows );
 else if (nCols || nRows)
 {
 aResult.SetToken( new ScMatrixFormulaCellToken( nCols, nRows));
 // Setting the new token actually forces an empty result at this top
 // left cell, so have that recalculated.
-SetDirty();
+SetDirty( bDirtyFlag );
 }
 }
 
@@ -1805,7 +1805,7 @@ void ScFormulaCell::Notify( SvtBroadca

[Libreoffice-commits] .: sc/inc sc/source

2012-08-22 Thread Libreoffice Gerrit user
 sc/inc/dpcache.hxx   |   22 +++-
 sc/source/core/data/dpcache.cxx  |  115 +---
 sc/source/core/data/dpobject.cxx |  183 ++-
 3 files changed, 205 insertions(+), 115 deletions(-)

New commits:
commit 44dcb37bf9339611559743f35a93dd674227b357
Author: Kohei Yoshida 
Date:   Wed Aug 22 23:10:45 2012 -0400

Abstract database connection from pivot cache to hide UNO API.

This is the first step toward unit-testing the initialization
code from the database source.

Change-Id: I1a7882ba443fd71d4210fb2e2caa195fb71dab92

diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 68b1029..d68f348 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -43,12 +43,6 @@
 #include 
 #include 
 
-namespace com { namespace sun { namespace star {
-namespace sdbc {
-class XRowSet;
-}
-}}}
-
 struct ScQueryParam;
 class ScDPObject;
 class ScDPItemData;
@@ -102,6 +96,20 @@ public:
 Field();
 };
 
+/**
+ * Interface for connecting to database source.  Column index is 0-based.
+ */
+class DBConnector
+{
+public:
+virtual long getColumnCount() const = 0;
+virtual rtl::OUString getColumnLabel(long nCol) const = 0;
+virtual bool first() = 0;
+virtual bool next() = 0;
+virtual void finish() = 0;
+virtual void getValue(long nCol, ScDPItemData& rData, short& rNumType) 
const = 0;
+};
+
 private:
 
 ScDocument* mpDoc;
@@ -148,7 +156,7 @@ public:
 
 const ItemsType& GetDimMemberValues( SCCOL nDim ) const;
 bool InitFromDoc(ScDocument* pDoc, const ScRange& rRange);
-bool InitFromDataBase(const  ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate);
+bool InitFromDataBase(DBConnector& rDB);
 
 SCROW  GetRowCount() const;
 SCROW  GetItemDataId( sal_uInt16 nDim, SCROW nRow, bool bRepeatIfEmpty ) 
const;
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index ff8fc6e..fa2b1ef 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -45,16 +45,8 @@
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-#include 
-
 #include 
 
-const double D_TIMEFACTOR = 86400.0;
-
 using namespace ::com::sun::star;
 
 using ::com::sun::star::uno::Exception;
@@ -165,85 +157,6 @@ void initFromCell(
 rData.SetEmpty();
 }
 
-void getItemValue(
-ScDPCache& rCache, ScDPItemData& rData, const Reference& xRow, 
sal_Int32 nType,
-long nCol, const Date& rNullDate, short& rNumType)
-{
-rNumType = NUMBERFORMAT_NUMBER;
-try
-{
-double fValue = 0.0;
-switch (nType)
-{
-case sdbc::DataType::BIT:
-case sdbc::DataType::BOOLEAN:
-{
-rNumType = NUMBERFORMAT_LOGICAL;
-fValue  = xRow->getBoolean(nCol) ? 1 : 0;
-rData.SetValue(fValue);
-break;
-}
-case sdbc::DataType::TINYINT:
-case sdbc::DataType::SMALLINT:
-case sdbc::DataType::INTEGER:
-case sdbc::DataType::BIGINT:
-case sdbc::DataType::FLOAT:
-case sdbc::DataType::REAL:
-case sdbc::DataType::DOUBLE:
-case sdbc::DataType::NUMERIC:
-case sdbc::DataType::DECIMAL:
-{
-//! do the conversion here?
-fValue = xRow->getDouble(nCol);
-rData.SetValue(fValue);
-break;
-}
-case sdbc::DataType::DATE:
-{
-rNumType = NUMBERFORMAT_DATE;
-
-util::Date aDate = xRow->getDate(nCol);
-fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate;
-rData.SetValue(fValue);
-break;
-}
-case sdbc::DataType::TIME:
-{
-rNumType = NUMBERFORMAT_TIME;
-
-util::Time aTime = xRow->getTime(nCol);
-fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
-   aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / 
D_TIMEFACTOR;
-rData.SetValue(fValue);
-break;
-}
-case sdbc::DataType::TIMESTAMP:
-{
-rNumType = NUMBERFORMAT_DATETIME;
-
-util::DateTime aStamp = xRow->getTimestamp(nCol);
-fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - 
rNullDate ) +
- ( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
-   aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) 
/ D_TIMEFACTOR;
-rData.SetValue(fValue);
-break;
-}
-case sdbc::DataType::CHAR:
-case sdbc::DataType::VARCHAR:
-case sdbc::DataType::LONGVARCHAR:
-case sdbc::D

[Libreoffice-commits] .: sc/inc sc/source unusedcode.easy

2012-08-10 Thread Matus Kukan
 sc/inc/compressedarray.hxx  |  185 
 sc/source/core/data/compressedarray.cxx |   27 
 unusedcode.easy |9 -
 3 files changed, 221 deletions(-)

New commits:
commit 07090cac4251e254b21676b77742c07f28cccaf4
Author: Matúš Kukan 
Date:   Fri Aug 10 22:50:25 2012 +0200

sc: this appears to be unused

Change-Id: I22a759ef55a46dc560ebe5f802c937f1d47bf645

diff --git a/sc/inc/compressedarray.hxx b/sc/inc/compressedarray.hxx
index eb38a3d..a20963d 100644
--- a/sc/inc/compressedarray.hxx
+++ b/sc/inc/compressedarray.hxx
@@ -36,8 +36,6 @@
 
 const size_t nScCompressedArrayDelta = 4;
 
-template< typename A, typename D > class ScCompressedArrayIterator;
-
 /** Compressed array of row (or column) entries, e.g. heights, flags, ...
 
 The array stores ranges of values such that consecutive values occupy only
@@ -102,13 +100,8 @@ public:
 // methods public for the coupled array sum methods
 /** Obtain index into entries for nPos */
 SC_DLLPUBLIC size_t  Search( A nPos ) const;
-/** Get number of entries */
-size_t  GetEntryCount() const;
 
 protected:
-
-friend class ScCompressedArrayIterator;
-
 size_t  nCount;
 size_t  nLimit;
 size_t  nDelta;
@@ -165,184 +158,6 @@ const D& ScCompressedArray::GetNextValue( size_t& 
nIndex, A& nEnd ) const
 return pData[nEntry].aValue;
 }
 
-
-template< typename A, typename D >
-size_t ScCompressedArray::GetEntryCount() const
-{
-return nCount;
-}
-
-
-// === ScCompressedArrayIterator =
-
-/** Iterator for ScCompressedArray.
-
-@ATTENTION: the iterator is not persistant if the underlying
-ScCompressedArray happens to be changed by any means, for example by
-setting new values or adding or removing or combining entries. If you do
-such things inside a loop you MUST resynchronize the iterator by calling
-Resync() with the row where resynchronization should
-start. After doing so, GetRangeStart() and
-GetRangeEnd() may not point to the previous access points
-anymore. Use with care.
- */
-
-template< typename A, typename D > class ScCompressedArrayIterator
-{
-public:
-ScCompressedArrayIterator(
-const ScCompressedArray & rArray,
-A nStart, A nEnd );
-/// Set new start and end, position on start.
-voidNewLimits( A nStart, A nEnd );
-A   GetIterStart() const;
-A   GetIterEnd() const;
-/// Advance by a single access point (e.g. row).
-booloperator ++();
-A   GetPos() const;
-operator bool() const;
-const D&operator *() const;
-/// Advance an entire range, one entry of the array.
-boolNextRange();
-A   GetRangeStart() const;
-A   GetRangeEnd() const;
-/// Resync to underlying array, calling Search().
-voidResync( A nPos );
-/** Set position without resyncing, avoid calling Search() if possible.
-Position obtained from steering coupled iterator is NOT checked for
-iterator bounds. */
-template< typename X >
-voidFollow( const ScCompressedArrayIterator& 
);
-
-private:
-const ScCompressedArray &  rArray;
-size_t  nIndex;
-A   nIterStart;
-A   nIterEnd;
-A   nCurrent;
-boolbEnd;
-};
-
-
-template< typename A, typename D >
-ScCompressedArrayIterator::ScCompressedArrayIterator(
-const ScCompressedArray & rArrayP, A nStart, A nEnd )
-: rArray( rArrayP )
-// other values set in NewLimits()
-{
-NewLimits( nStart, nEnd);
-}
-
-
-template< typename A, typename D >
-void ScCompressedArrayIterator::NewLimits( A nStart, A nEnd )
-{
-nIterStart = nStart;
-nIterEnd = nEnd;
-nIndex = rArray.Search( nStart);
-nCurrent = GetRangeStart();
-bEnd = (nIterEnd < nIterStart);
-}
-
-
-template< typename A, typename D >
-A ScCompressedArrayIterator::GetIterStart() const
-{
-return nIterStart;
-}
-
-
-template< typename A, typename D >
-A ScCompressedArrayIterator::GetIterEnd() const
-{
-return nIterEnd;
-}
-
-
-template< typename A, typename D >
-bool ScCompressedArrayIterator::operator++()
-{
-if (nCurrent < GetRangeEnd())
-{
-++nCurrent;
-return true;
-}
-else
-return NextRange();
-}
-
-
-template< typename A, typename D >
-A ScCompressedArrayIterator::GetPos() const
-{
-return nCurrent;

[Libreoffice-commits] .: sc/inc sc/source

2012-08-09 Thread Kohei Yoshida
 sc/inc/queryentry.hxx  |   40 ++---
 sc/source/core/tool/queryentry.cxx |   40 ++---
 2 files changed, 40 insertions(+), 40 deletions(-)

New commits:
commit 81cfa56fb42b67edf50f942f0e1aafd459a8a298
Author: Kohei Yoshida 
Date:   Thu Aug 9 20:23:13 2012 -0400

Reverting copyright notices to original LGPL.

These files do contains at least several lines from the Oracle-authored
source files.

Change-Id: I4f4a8e1487cacb6de92c409bd2b63149840bdf4d

diff --git a/sc/inc/queryentry.hxx b/sc/inc/queryentry.hxx
index 5c88730..021a449 100644
--- a/sc/inc/queryentry.hxx
+++ b/sc/inc/queryentry.hxx
@@ -1,30 +1,30 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+/*
  *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
- * Major Contributor(s):
- *   Copyright (C) 2011 Kohei Yoshida 
+ * OpenOffice.org - a multi-platform office productivity suite
  *
- * All Rights Reserved.
+ * This file is part of OpenOffice.org.
  *
- * For minor contributions see the git repository.
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
  *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * 
+ * for a copy of the LGPLv3 License.
+ *
+ /
 
 #ifndef __SC_QUERYENTRY_HXX__
 #define __SC_QUERYENTRY_HXX__
diff --git a/sc/source/core/tool/queryentry.cxx 
b/sc/source/core/tool/queryentry.cxx
index 1f9be97..7abb8fa 100644
--- a/sc/source/core/tool/queryentry.cxx
+++ b/sc/source/core/tool/queryentry.cxx
@@ -1,30 +1,30 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+/*
  *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
- * Major Contributor(s):
- *   Copyright (C) 2011 Kohei Yoshida 
+ * OpenOffice.org - a multi-platform office productivity suite
  *
- * All Rights Reserved.
+ * This file is part of OpenOffice.org.
  *
- * For minor contributions see the git repository.
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
  *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
+ * OpenOffice.org is distributed

[Libreoffice-commits] .: sc/inc sc/source unusedcode.easy

2012-08-09 Thread Julien Nabet
 sc/inc/document.hxx  |4 
 sc/source/core/data/document.cxx |   19 ---
 unusedcode.easy  |2 --
 3 files changed, 25 deletions(-)

New commits:
commit 49ab16c9ad3eb0d27f8c66f2b535a8495671878f
Author: Julien Nabet 
Date:   Thu Aug 9 19:34:13 2012 +0200

Bin 2 other functions

ScDocument::GetFormattedAndUsedArea(short, short&, int&) const
ScDocument::InitializeAllNoteCaptions(bool)

Change-Id: I210815aef7c4096b040af841444dc65dd5138606

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 8fcdc6d..7b8e48b 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -816,9 +816,6 @@ public:
 /** Creates the captions of all uninitialized cell notes in the specified 
sheet.
 @param bForced  True = always create all captions, false = skip when 
Undo is disabled. */
 voidInitializeNoteCaptions( SCTAB nTab, bool bForced = false );
-/** Creates the captions of all uninitialized cell notes in all sheets.
-@param bForced  True = always create all captions, false = skip when 
Undo is disabled. */
-voidInitializeAllNoteCaptions( bool bForced = false );
 
 voidSetDrawPageSize(SCTAB nTab);
 
@@ -935,7 +932,6 @@ public:
 SCCOL& rEndCol, SCROW& rEndRow, bool 
bIncludeOld, bool bOnlyDown ) const;
 SC_DLLPUBLIC bool   GetCellArea( SCTAB nTab, SCCOL& rEndCol, 
SCROW& rEndRow ) const;
 SC_DLLPUBLIC bool   GetTableArea( SCTAB nTab, SCCOL& rEndCol, 
SCROW& rEndRow ) const;
-SC_DLLPUBLIC void   GetFormattedAndUsedArea( SCTAB nTab, SCCOL& 
rEndCol, SCROW& rEndRow ) const;
 SC_DLLPUBLIC bool   GetPrintArea( SCTAB nTab, SCCOL& rEndCol, 
SCROW& rEndRow,
 bool bNotes = true ) const;
 SC_DLLPUBLIC bool   GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, 
SCROW nEndRow,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 58f834f..c160b68 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -940,19 +940,6 @@ bool ScDocument::GetTableArea( SCTAB nTab, SCCOL& rEndCol, 
SCROW& rEndRow ) cons
 return false;
 }
 
-void ScDocument::GetFormattedAndUsedArea( SCTAB nTab, SCCOL& rEndCol, SCROW& 
rEndRow ) const
-{
-if (VALIDTAB(nTab) && nTab < static_cast (maTabs.size()))
-if (maTabs[nTab])
-{
-maTabs[nTab]->GetPrintArea( rEndCol, rEndRow, true, true );
-return;
-}
-
-rEndCol = 0;
-rEndRow = 0;
-}
-
 bool ScDocument::ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& 
rStartRow, SCCOL& rEndCol, SCROW& rEndRow) const
 {
 if (!ValidTab(nTab) || nTab >= static_cast (maTabs.size()) || 
!maTabs[nTab])
@@ -3266,12 +3253,6 @@ void ScDocument::InitializeNoteCaptions( SCTAB nTab, 
bool bForced )
 maTabs[ nTab ]->InitializeNoteCaptions( bForced );
 }
 
-void ScDocument::InitializeAllNoteCaptions( bool bForced )
-{
-for( SCTAB nTab = 0; nTab < static_cast(maTabs.size()); ++nTab )
-InitializeNoteCaptions( nTab, bForced );
-}
-
 void ScDocument::SetDirty()
 {
 bool bOldAutoCalc = GetAutoCalc();
diff --git a/unusedcode.easy b/unusedcode.easy
index 4681351..0a25bec 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -11,8 +11,6 @@ ScCompressedArray::Remove(int, unsigned 
long)
 ScCompressedArray::ScCompressedArray(int, unsigned short 
const&, unsigned long)
 ScCompressedArray::ScCompressedArray(int, unsigned short 
const*, unsigned long)
 ScCompressedArray::SetValue(int, unsigned short const&)
-ScDocument::GetFormattedAndUsedArea(short, short&, int&) const
-ScDocument::InitializeAllNoteCaptions(bool)
 ScTabView::HideCursor()
 
ScVbaFormat::setNumberFormat(com::sun::star::lang::Locale,
 rtl::OUString const&)
 ScVbaFormat::getAddIndent()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-08-05 Thread Markus Mohrhard
 sc/inc/column.hxx   |3 
 sc/source/core/data/column2.cxx |  169 ++--
 2 files changed, 117 insertions(+), 55 deletions(-)

New commits:
commit 1e2964e55e6fc791b911998ca710a9f174c3d1ef
Author: Markus Mohrhard 
Date:   Sun Aug 5 20:28:03 2012 +0200

skip hidden rows when moving with the cursor, fdo#45020

Change-Id: I3b12d774914599489dea2bb711b2d057111b677b

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 6f776e1..6bc8c8c 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -389,6 +389,9 @@ public:
 
 private:
 ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& 
rDestDoc, const ScAddress& rDestPos);
+
+SCROW FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const;
+SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const;
 };
 
 
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index dba0fc6..f22fec0 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1307,11 +1307,102 @@ bool ScColumn::GetNextDataPos(SCROW& rRow) const   
 // greater than rRow
 return bMore;
 }
 
+SCROW ScColumn::FindNextVisibleRow(SCROW nRow, bool bForward) const
+{
+if(bForward)
+{
+nRow++;
+SCROW nEndRow = 0;
+bool bHidden = pDocument->RowHidden(nRow, nTab, NULL, &nEndRow);
+if(bHidden)
+return std::min(MAXROW, nEndRow + 1);
+else
+return nRow;
+}
+else
+{
+nRow--;
+SCROW nStartRow = MAXROW;
+bool bHidden = pDocument->RowHidden(nRow, nTab, &nStartRow, NULL);
+if(bHidden)
+return std::max(0, nStartRow - 1);
+else
+return nRow;
+}
+}
+
+SCROW ScColumn::FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const
+{
+if(bForward)
+{
+bool bFound = false;
+do
+{
+nRow++;
+SCROW nEndRow = 0;
+bool bHidden = pDocument->RowHidden(nRow, nTab, NULL, &nEndRow);
+if(bHidden)
+{
+nRow = nEndRow + 1;
+if(nRow >= MAXROW)
+return MAXROW;
+}
+
+SCSIZE nIndex;
+bool bThere = Search( nRow, nIndex );
+if( bThere && !maItems[nIndex].pCell->IsBlank())
+return nRow;
+else if(nIndex >= maItems.size())
+return MAXROW;
+else
+{
+if(bThere)
+nRow = maItems[nIndex+1].nRow - 1;
+else
+nRow = maItems[nIndex].nRow - 1;
+}
+}
+while(!bFound && nRow < MAXROW);
+
+return MAXROW;
+}
+else
+{
+bool bFound = false;
+do
+{
+nRow--;
+SCROW nStartRow = MAXROW;
+bool bHidden = pDocument->RowHidden(nRow, nTab, &nStartRow, NULL);
+if(bHidden)
+{
+nRow = nStartRow - 1;
+if(nRow <= 0)
+return 0;
+}
+
+SCSIZE nIndex;
+bool bThere = Search( nRow, nIndex );
+if(bThere && !maItems[nIndex].pCell->IsBlank())
+return nRow;
+else if(nIndex == 0)
+return 0;
+else
+nRow = maItems[nIndex-1].nRow + 1;
+}
+while(!bFound && nRow > 0);
+
+return 0;
+}
+}
+
 void ScColumn::FindDataAreaPos(SCROW& rRow, long nMovY) const
 {
-if (!nMovY) return;
+if (!nMovY)
+   return;
 bool bForward = (nMovY>0);
 
+// check if we are in a data area
 SCSIZE nIndex;
 bool bThere = Search(rRow, nIndex);
 if (bThere && maItems[nIndex].pCell->IsBlank())
@@ -1320,69 +1411,37 @@ void ScColumn::FindDataAreaPos(SCROW& rRow, long nMovY) 
const
 size_t nLastIndex = maItems.size() - 1;
 if (bThere)
 {
-SCROW nLast = rRow;
-SCSIZE nOldIndex = nIndex;
-if (bForward)
+SCROW nNextRow = FindNextVisibleRow(rRow, bForward);
+SCSIZE nNewIndex;
+bool bNextThere = Search(nNextRow, nNewIndex);
+if(bNextThere && maItems[nNewIndex].pCell->IsBlank())
+bNextThere = false;
+
+if(bNextThere)
 {
-if (nIndexIsBlank())
-{
-++nIndex;
-++nLast;
-}
-if (nIndex==nLastIndex)
-if (maItems[nIndex].nRow==nLast+1 && 
!maItems[nIndex].pCell->IsBlank())
-++nLast;
+nNextRow = FindNextVisibleRow(nLastRow, bForward);
+bNextThere = Search(nNextRow, nNewIndex);
+if(!bNextThere || maItems[nNewIndex].pCell->IsBlank())
+bNextThere = false;
+else
+nLastRow = nNextRow;
 }
+while(bNextTh

[Libreoffice-commits] .: sc/inc sc/source

2012-08-02 Thread Kohei Yoshida
 sc/inc/dapiuno.hxx|2 -
 sc/inc/dpsave.hxx |2 -
 sc/source/filter/inc/pivottablebuffer.hxx |5 ++
 sc/source/filter/oox/pivottablebuffer.cxx |   52 +++---
 4 files changed, 48 insertions(+), 13 deletions(-)

New commits:
commit 1e3d97dfe9747fa70cdcf642a4a710c3d90cc95c
Author: Kohei Yoshida 
Date:   Thu Aug 2 22:39:55 2012 -0400

Use the internal API to set field item's properties.

This is 1000 times faster.

Change-Id: I09a75f70c8344898b2aea6bc5a8ca6b5fa9f1065

diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx
index e26906a..ac9079d 100644
--- a/sc/inc/dapiuno.hxx
+++ b/sc/inc/dapiuno.hxx
@@ -265,7 +265,7 @@ public:
 throw(::com::sun::star::uno::RuntimeException);
 
 static const com::sun::star::uno::Sequence& getUnoTunnelId();
-static ScDataPilotDescriptorBase* getImplementation( const 
com::sun::star::uno::Reference<
+SC_DLLPUBLIC static ScDataPilotDescriptorBase* getImplementation( const 
com::sun::star::uno::Reference<
 
com::sun::star::sheet::XDataPilotDescriptor> xObj );
 
 // XTypeProvider (overloaded in 
ScDataPilotTableObj)
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index 28bfafd..14a0032 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -298,7 +298,7 @@ public:
  * manages its life cycle; hence the caller must
  * not delete this object.
  */
-ScDPSaveDimension* GetDimensionByName(const ::rtl::OUString& rName);
+SC_DLLPUBLIC ScDPSaveDimension* GetDimensionByName(const ::rtl::OUString& 
rName);
 SC_DLLPUBLIC ScDPSaveDimension* GetDataLayoutDimension();
 SC_DLLPUBLIC ScDPSaveDimension* GetExistingDataLayoutDimension() const;
 
diff --git a/sc/source/filter/inc/pivottablebuffer.hxx 
b/sc/source/filter/inc/pivottablebuffer.hxx
index 82e1501..0ae79f9 100644
--- a/sc/source/filter/inc/pivottablebuffer.hxx
+++ b/sc/source/filter/inc/pivottablebuffer.hxx
@@ -38,6 +38,8 @@ namespace com { namespace sun { namespace star {
 namespace sheet { class XDataPilotField; }
 } } }
 
+class ScDPObject;
+
 namespace oox {
 namespace xls {
 
@@ -374,6 +376,8 @@ public:
 /** Returns the source column index of the pivot field with the passed 
index, or -1. */
 sal_Int32   getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const;
 
+ScDPObject* getDPObject();
+
 private:
 typedef RefVector< PivotTableField >PivotTableFieldVector;
 typedef RefVector< PivotTableFilter >   PivotTableFilterVector;
@@ -391,6 +395,7 @@ private:
 static void importFields( IndexVector& orFields, 
SequenceInputStream& rStrm );
 
 private:
+ScDPObject* mpDPObject;
 PivotTableFieldVector maFields; /// All pivot table fields.
 PivotTableField maDataField;/// Data layout field.
 IndexVector maRowFields;/// Indexes to fields in row 
dimension.
diff --git a/sc/source/filter/oox/pivottablebuffer.cxx 
b/sc/source/filter/oox/pivottablebuffer.cxx
index 55fc315..cd25e34 100644
--- a/sc/source/filter/oox/pivottablebuffer.cxx
+++ b/sc/source/filter/oox/pivottablebuffer.cxx
@@ -54,6 +54,10 @@
 #include "addressconverter.hxx"
 #include "biffinputstream.hxx"
 
+#include "dapiuno.hxx"
+#include "dpobject.hxx"
+#include "dpsave.hxx"
+
 namespace oox {
 namespace xls {
 
@@ -63,6 +67,7 @@ using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::sheet;
 using namespace ::com::sun::star::table;
 using namespace ::com::sun::star::uno;
+using namespace com::sun::star;
 
 using ::rtl::OUString;
 
@@ -675,6 +680,9 @@ Reference< XDataPilotField > 
PivotTableField::convertRowColPageField( sal_Int32
 
 if( xDPField.is() )
 {
+// TODO: Use this to set properties directly, bypassing the slow uno 
layer.
+ScDPObject* pDPObj = mrPivotTable.getDPObject();
+
 PropertySet aPropSet( xDPField );
 using namespace ::com::sun::star::sheet;
 
@@ -765,18 +773,27 @@ Reference< XDataPilotField > 
PivotTableField::convertRowColPageField( sal_Int32
 aPropSet.setProperty( PROP_SortInfo, aSortInfo );
 
 // item settings
-if( const PivotCacheField* pCacheField = 
mrPivotTable.getCacheField( mnFieldIndex ) ) try
+if (const PivotCacheField* pCacheField = 
mrPivotTable.getCacheField(mnFieldIndex))
 {
-Reference< XNameAccess > xDPItemsNA( xDPField->getItems(), 
UNO_QUERY_THROW );
-for( ItemModelVector::iterator aIt = maItems.begin(), aEnd = 
maItems.end(); aIt != aEnd; ++aIt )
+ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+ScDPSaveDimension* pDim = 
pSaveData->GetDimensionByName(pCacheField->getName());
+
+try
 {
-if( aIt->mnType == XML_data )
+for( ItemModelVector::iter

[Libreoffice-commits] .: sc/inc sc/source

2012-07-26 Thread Kohei Yoshida
 sc/inc/document.hxx  |1 -
 sc/inc/table.hxx |1 -
 sc/source/core/data/document.cxx |8 
 sc/source/core/data/table5.cxx   |8 
 sc/source/ui/app/transobj.cxx|2 +-
 5 files changed, 1 insertion(+), 19 deletions(-)

New commits:
commit 261f56fa90796686709f5ae7de3fba96121c0709
Author: Kohei Yoshida 
Date:   Thu Jul 26 20:46:40 2012 -0400

Actually this method is totally redundant. Remove it.

There is already an existing method that does the same thing.

Change-Id: I627fa73cca8da35d703000bd27d33168612b4126

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 39fce78..9893e7a 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1371,7 +1371,6 @@ public:
 SCROW   CountNonFilteredRows(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab);
 
 bool IsManualRowHeight(SCROW nRow, SCTAB nTab) const;
-void SetRowHeightManual(SCROW nRow, SCTAB nTab, bool bManual);
 
 /**
  * Write all column row flags to table's flag data, because not all column
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0f32c31..bb365db 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -747,7 +747,6 @@ public:
 SCROW   CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
 
 bool IsManualRowHeight(SCROW nRow) const;
-void SetRowHeightManual(SCROW nRow, bool bManual);
 
 voidSyncColRowFlags();
 
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index df18748..de977d8 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3994,14 +3994,6 @@ bool ScDocument::IsManualRowHeight(SCROW nRow, SCTAB 
nTab) const
 return maTabs[nTab]->IsManualRowHeight(nRow);
 }
 
-void ScDocument::SetRowHeightManual(SCROW nRow, SCTAB nTab, bool bManual)
-{
-if (!ValidTab(nTab) || nTab >= static_cast(maTabs.size()) || 
!maTabs[nTab])
-return;
-
-maTabs[nTab]->SetRowHeightManual(nRow, bManual);
-}
-
 void ScDocument::SyncColRowFlags()
 {
 TableContainer::iterator it = maTabs.begin();
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 8356dc5..3e244c2 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -959,14 +959,6 @@ bool ScTable::IsManualRowHeight(SCROW nRow) const
 return (pRowFlags->GetValue(nRow) & CR_MANUALSIZE) != 0;
 }
 
-void ScTable::SetRowHeightManual(SCROW nRow, bool bManual)
-{
-if (bManual)
-pRowFlags->OrValue(nRow, CR_MANUALSIZE);
-else
-pRowFlags->AndValue(nRow, 
sal::static_int_cast(~CR_MANUALSIZE));
-}
-
 namespace {
 
 void lcl_syncFlags(ScFlatBoolColSegments& rColSegments, ScFlatBoolRowSegments& 
rRowSegments,
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 9d53c7d..f0a609c 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -643,7 +643,7 @@ void ScTransferObj::InitDocShell()
 
 //  if height was set manually, that flag has to be copied, too
 bool bManual = pDoc->IsManualRowHeight(nRow, nSrcTab);
-pDestDoc->SetRowHeightManual(nRow, 0, bManual);
+pDestDoc->SetManualHeight(nRow, nRow, 0, bManual);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-07-26 Thread Kohei Yoshida
 sc/inc/document.hxx  |4 +++-
 sc/inc/table.hxx |3 +++
 sc/source/core/data/document.cxx |   23 ---
 sc/source/core/data/table5.cxx   |   13 +
 sc/source/ui/app/transobj.cxx|7 ++-
 5 files changed, 37 insertions(+), 13 deletions(-)

New commits:
commit 03720cfb47870d5bf1619cae8c6ed66204b6415b
Author: Kohei Yoshida 
Date:   Thu Jul 26 17:55:18 2012 -0400

Try to encapsulate the row flag array.

Eventually this flag array will go. The manual row height flag is
the last one standing...

Change-Id: I3f6be511eba50836d785ddf20ef08878797f6fe0

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 6d4a02e..39fce78 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1341,7 +1341,6 @@ public:
 SC_DLLPUBLIC sal_uInt8  GetRowFlags( SCROW nRow, SCTAB nTab ) 
const;
 
 SC_DLLPUBLIC const ScBitMaskCompressedArray< SCROW, sal_uInt8> & 
GetRowFlagsArray( SCTAB nTab ) const;
-SC_DLLPUBLIC   ScBitMaskCompressedArray< SCROW, sal_uInt8> & 
GetRowFlagsArrayModifiable( SCTAB nTab );
 
 SC_DLLPUBLIC void   GetAllRowBreaks(::std::set& rBreaks, 
SCTAB nTab, bool bPage, bool bManual) const;
 SC_DLLPUBLIC void   GetAllColBreaks(::std::set& rBreaks, 
SCTAB nTab, bool bPage, bool bManual) const;
@@ -1371,6 +1370,9 @@ public:
 SCROW   LastNonFilteredRow(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab);
 SCROW   CountNonFilteredRows(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab);
 
+bool IsManualRowHeight(SCROW nRow, SCTAB nTab) const;
+void SetRowHeightManual(SCROW nRow, SCTAB nTab, bool bManual);
+
 /**
  * Write all column row flags to table's flag data, because not all column
  * row attributes are stored in the flag data members.  This is necessary
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 966c458..0f32c31 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -746,6 +746,9 @@ public:
 SCROW   LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
 SCROW   CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
 
+bool IsManualRowHeight(SCROW nRow) const;
+void SetRowHeightManual(SCROW nRow, bool bManual);
+
 voidSyncColRowFlags();
 
 voidStripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f3724d5..df18748 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3754,13 +3754,6 @@ sal_uInt8 ScDocument::GetRowFlags( SCROW nRow, SCTAB 
nTab ) const
 return 0;
 }
 
-ScBitMaskCompressedArray< SCROW, sal_uInt8> & 
ScDocument::GetRowFlagsArrayModifiable(
-SCTAB nTab )
-{
-return const_cast< ScBitMaskCompressedArray< SCROW, sal_uInt8> & >(
-GetRowFlagsArray( nTab));
-}
-
 const ScBitMaskCompressedArray< SCROW, sal_uInt8> & 
ScDocument::GetRowFlagsArray(
 SCTAB nTab ) const
 {
@@ -3993,6 +3986,22 @@ SCROW ScDocument::CountNonFilteredRows(SCROW nStartRow, 
SCROW nEndRow, SCTAB nTa
 return maTabs[nTab]->CountNonFilteredRows(nStartRow, nEndRow);
 }
 
+bool ScDocument::IsManualRowHeight(SCROW nRow, SCTAB nTab) const
+{
+if (!ValidTab(nTab) || nTab >= static_cast(maTabs.size()) || 
!maTabs[nTab])
+return false;
+
+return maTabs[nTab]->IsManualRowHeight(nRow);
+}
+
+void ScDocument::SetRowHeightManual(SCROW nRow, SCTAB nTab, bool bManual)
+{
+if (!ValidTab(nTab) || nTab >= static_cast(maTabs.size()) || 
!maTabs[nTab])
+return;
+
+maTabs[nTab]->SetRowHeightManual(nRow, bManual);
+}
+
 void ScDocument::SyncColRowFlags()
 {
 TableContainer::iterator it = maTabs.begin();
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 77939a2..8356dc5 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -954,6 +954,19 @@ SCROW ScTable::CountNonFilteredRows(SCROW nStartRow, SCROW 
nEndRow) const
 return nCount;
 }
 
+bool ScTable::IsManualRowHeight(SCROW nRow) const
+{
+return (pRowFlags->GetValue(nRow) & CR_MANUALSIZE) != 0;
+}
+
+void ScTable::SetRowHeightManual(SCROW nRow, bool bManual)
+{
+if (bManual)
+pRowFlags->OrValue(nRow, CR_MANUALSIZE);
+else
+pRowFlags->AndValue(nRow, 
sal::static_int_cast(~CR_MANUALSIZE));
+}
+
 namespace {
 
 void lcl_syncFlags(ScFlatBoolColSegments& rColSegments, ScFlatBoolRowSegments& 
rRowSegments,
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 0d35c45..9d53c7d 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -632,9 +632,6 @@ void ScTransferObj::InitDocShell()
 else
 pDestDoc->SetColWidth( nCol, 0, pDoc->GetColWidth( nCol, 
nSrcTab ) );
 
-ScBitMaskCompressedArray< SCROW, sal_uInt8> & rDestRowFlags =
-pDestDoc->GetRowFlagsArrayM

[Libreoffice-commits] .: sc/inc sc/source

2012-07-24 Thread Eike Rathke
 sc/inc/dptabsrc.hxx  |2 +-
 sc/source/core/data/dptabsrc.cxx |   17 -
 2 files changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 3536fcd999f16525f20a1fff5c2512b565511d7b
Author: Eike Rathke 
Date:   Tue Jul 24 10:53:33 2012 +0200

prevent crash in malformed pivot table loaded from .xls

ScDPMember::GetItemData() unconditionally returned a reference to a
ScDPItemData pointer obtained through ScDPSource::GetItemDataById()
ScDPTableData::GetMemberById() ScDPCache::GetItemDataById() that can be
null for malformed entries. Changed ScDPMember::GetItemData() to return
a pointer instead and adapted callers to check for null.

3.5.x in ScDPSource::GetItemDataById() had a check for null pointer and
added an empty ScDPItemData element to the cache for this case and
returned the pointer to that entry (marked as todo). This is not the
case anymore.

Change-Id: I241c232d7182f5d58e8531af540e69b26ab4888a

diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx
index b69846b..9fced30 100644
--- a/sc/inc/dptabsrc.hxx
+++ b/sc/inc/dptabsrc.hxx
@@ -755,7 +755,7 @@ public:
 
 rtl::OUString GetNameStr() const;
 voidFillItemData( ScDPItemData& rData ) const;
-const ScDPItemData&  GetItemData() const;
+const ScDPItemData*  GetItemData() const;
 SCROW GetItemDataId() const { return mnDataId; }
 bool IsNamedItem(SCROW nIndex) const;
 
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 8b7d6f8..039fa58 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -2577,7 +2577,8 @@ bool ScDPMember::IsNamedItem(SCROW nIndex) const
 (long)::rtl::math::approxFloor( pData->GetValue() ),
 nHier, nLev );
 //  fValue is converted from integer, so simple comparison works
-return nComp == GetItemData().GetValue();
+const ScDPItemData* pData2 = GetItemData();
+return pData && nComp == pData2->GetValue();
 }
 }
 
@@ -2613,7 +2614,8 @@ void ScDPMember::FillItemData( ScDPItemData& rData ) const
 {
 //! handle date hierarchy...
 
-rData = GetItemData() ;
+const ScDPItemData* pData = GetItemData();
+rData = (pData ? *pData : ScDPItemData());
 }
 
 const OUString* ScDPMember::GetLayoutName() const
@@ -2628,7 +2630,10 @@ long ScDPMember::GetDim() const
 
 rtl::OUString ScDPMember::GetNameStr() const
 {
-return pSource->GetData()->GetFormattedString(nDim, GetItemData());
+const ScDPItemData* pData = GetItemData();
+if (pData)
+return pSource->GetData()->GetFormattedString(nDim, *pData);
+return rtl::OUString();
 }
 
 ::rtl::OUString SAL_CALL ScDPMember::getName() throw(uno::RuntimeException)
@@ -2723,9 +2728,11 @@ const ScDPCache* ScDPSource::GetCache()
 return ( GetData()!=NULL) ? GetData()->GetCacheTable().getCache() : NULL ;
 }
 
-const ScDPItemData& ScDPMember::GetItemData() const
+const ScDPItemData* ScDPMember::GetItemData() const
 {
-return *pSource->GetItemDataById(nDim, mnDataId);
+const ScDPItemData* pData = pSource->GetItemDataById(nDim, mnDataId);
+SAL_WARN_IF( !pData, "sc", "ScDPMember::GetItemData: what data? nDim " << 
nDim << ", mnDataId " << mnDataId);
+return pData;
 }
 
 const ScDPItemData* ScDPSource::GetItemDataById(long nDim, long nId)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-07-18 Thread Markus Mohrhard
 sc/inc/sc.hrc  |   66 ++
 sc/source/ui/navipi/navipi.src |   25 
 sc/source/ui/src/scstring.src  |  254 +
 3 files changed, 345 insertions(+)

New commits:
commit dc05a825e71316e6f602e5c8dfcd3d10ecb6252f
Author: Markus Mohrhard 
Date:   Wed Jul 18 15:24:46 2012 +0200

Revert "hrc cleanup: Remove unused Strings in sc", fdo#52207

This commit is totally broken and removes a lot of still used strings.
Please TEST commits before removing stuff

This reverts commit c1ea4676ba67185a933fce387a6e87095070.

Change-Id: I065c17385ced86857c938e4102b9473d622ac59d

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 19e9396..e92ec8c 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -687,6 +687,14 @@
 #define RID_MN_INSERT_FIELDS(SC_RESOURCE_START+63)
 
 #define STR_START   (SC_RESOURCE_START+100)
+#define STR_ROWHEIGHT   (STR_START)
+#define STR_ROWHEIGHT_TITLE (STR_START + 1)
+#define STR_OPT_ROWHEIGHT   (STR_START + 2)
+#define STR_OPT_ROWHEIGHT_TITLE (STR_START + 3)
+#define STR_COLWIDTH(STR_START + 4)
+#define STR_COLWIDTH_TITLE  (STR_START + 5)
+#define STR_OPT_COLWIDTH(STR_START + 6)
+#define STR_OPT_COLWIDTH_TITLE  (STR_START + 7)
 #define SCSTR_UNDEFINED (STR_START + 8)
 #define SCSTR_NONAME(STR_START + 9)
 #define SCSTR_NONE  (STR_START + 10)
@@ -694,12 +702,18 @@
 #define SCSTR_FILTER_NOTEMPTY   (STR_START + 12)
 #define SCSTR_COLUMN(STR_START + 13)
 #define SCSTR_ROW   (STR_START + 14)
+#define SCSTR_NEW   (STR_START + 15)
 #define SCSTR_ADD   (STR_START + 16)
+#define SCSTR_REMOVE(STR_START + 17)
+#define SCSTR_CANCEL(STR_START + 18)
 #define SCSTR_MODIFY(STR_START + 19)
+#define SCSTR_SHOWTABLE (STR_START + 20)
+#define SCSTR_HIDDENTABLES  (STR_START + 21)
 #define SCSTR_SELECTDB  (STR_START + 22)
 #define SCSTR_AREAS (STR_START + 23)
 #define SCSTR_TABLE (STR_START + 24)
 #define SCSTR_NAME  (STR_START + 25)
+#define SCSTR_INSTABLE  (STR_START + 26)
 #define SCSTR_APDTABLE  (STR_START + 27)
 #define SCSTR_RENAMETAB (STR_START + 28)
 #define STR_INSERTGRAPHIC   (STR_START + 29)
@@ -713,17 +727,28 @@
 
 #define SCSTR_PROTECTDOC(STR_START + 39)
 #define SCSTR_UNPROTECTDOC  (STR_START + 40)
+#define SCSTR_PROTECTTAB(STR_START + 41)
 #define SCSTR_UNPROTECTTAB  (STR_START + 42)
 #define SCSTR_PASSWORD  (STR_START + 43)
 #define SCSTR_PASSWORDOPT   (STR_START + 44)
 #define SCSTR_WRONGPASSWORD (STR_START + 45)
 
 #define SCSTR_PIVOTSHELL(STR_START + 46)
+#define SCSTR_END   (STR_START + 47)
+#define SCSTR_STAT_PRINT(STR_START + 48)
 
 #define SCSTR_UNKNOWN   (STR_START + 49)
+#define SCSTR_CHAR_ATTRS(STR_START + 50)
 #define SCSTR_ALL   (STR_START + 51)
 #define SCSTR_STDFILTER (STR_START + 52)
 
+// Cfg-Item-names
+#define SCSTR_CFG_APP   (STR_START + 53)
+#define SCSTR_CFG_DOC   (STR_START + 54)
+#define SCSTR_CFG_VIEW  (STR_START + 55)
+#define SCSTR_CFG_SPELLCHECK(STR_START + 56)
+#define SCSTR_CFG_PRINT (STR_START + 57)
+
 #define SCSTR_AUDITSHELL(STR_START + 58)
 
 #define SCSTR_CHARSET_USER  (STR_START + 59)
@@ -731,8 +756,12 @@
 #define SCSTR_FIELDSEP  (STR_START + 61)
 #define SCSTR_TEXTSEP   (STR_START + 62)
 
+#define SCSTR_CFG_INPUT (STR_START + 65)
+
 #define SCSTR_TOP10FILTER   (STR_START + 66)
 
+#define SCSTR_CFG_NAVIPI(STR_START + 67)
+
 #define SCSTR_DRAWFORMSHELL (STR_START + 70)
 #define SCSTR_CELLSHELL (STR_START + 71)
 #define SCSTR_FORMATSHELL   (STR_START + 72)
@@ -741,6 +770,12 @@
 #define SCSTR_GRAPHICSHELL  (STR_START + 75)
 #define SCSTR_PAGEBREAKSHELL(STR_START + 76)
 
+#define SCSTR_GRFILTER_OPENERROR (STR_START + 77)
+#define SCSTR_GRFILTER_IOERROR   (STR_START + 78)
+#define SCSTR_GRFILTER_FORMATERROR   (STR_START + 79)
+#define SCSTR_GRFILTER_VERSIONERROR  (STR_START + 80)
+#define SCSTR_GRFILTER_FILTERERROR   (STR_START + 81)
+#define SCSTR_GRFILTER_TOOBIG(STR_START + 82)
 #define SCSTR_UNDO_GRAFFILTER(STR_START + 83)
 
 #define SCSTR_CHG_PROTECT   (STR_START + 86)
@@ -756,9 +791,26 @@
 #define STR_REPLCELLSWARN   (STR_START + 91)
 
 #define SCSTR_DPFUNCLISTBOX (STR_START + 92)
+#define SCSTR_ALLFILTER (STR_START + 94)
 #define SCSTR_MOREBTN_MOREOPTIONS   (STR_START + 95)
 #define SCSTR_MOREBTN_FEWEROPTIONS  (STR_START + 96)
 
+// items
+
+#define SCSTR_HOR_JUSTIFY_LEFT  (STR_START + 100)
+#define SCSTR_HOR_JUSTIFY_CENTER(STR_START + 101)
+#define SCSTR_HOR_JUSTIFY_RIGHT (STR_START + 102)
+#define SCSTR_HOR_JUSTIFY_BLOCK (STR_START + 103)
+#defi

[Libreoffice-commits] .: sc/inc sc/source unotools/inc unotools/source

2012-07-11 Thread Markus Mohrhard
 sc/inc/chgviset.hxx  |   15 +++
 sc/source/core/tool/chgviset.cxx |   13 ++---
 sc/source/ui/view/viewutil.cxx   |2 +-
 unotools/inc/unotools/textsearch.hxx |3 +++
 unotools/source/i18n/textsearch.cxx  |   33 +
 5 files changed, 50 insertions(+), 16 deletions(-)

New commits:
commit c5653e812eb9729581e24c5e7822441b00b6d059
Author: Sören Möller 
Date:   Mon Jul 9 21:48:26 2012 +0200

Replaced deprecated tools/String with OUString in sc/../chgviset

Added new TextSearch::SearchForward mirroring TextSearch::SearchFrwrd using 
OUString and sal_Int32 to make it possible to replace all uses of tools/String

Change-Id: I260d8d3a23d634eab37f28a5ceaf61ace5040540

diff --git a/sc/inc/chgviset.hxx b/sc/inc/chgviset.hxx
index 6d95abc..f3e1dd9 100644
--- a/sc/inc/chgviset.hxx
+++ b/sc/inc/chgviset.hxx
@@ -29,7 +29,6 @@
 #define SC_CHGVISET_HXX
 
 #include 
-#include 
 #include "rangelst.hxx"
 #include "scdllapi.h"
 
@@ -50,8 +49,8 @@ private:
 utl::TextSearch*pCommentSearcher;
 DateTimeaFirstDateTime;
 DateTimeaLastDateTime;
-String  aAuthorToShow;
-String  aComment;
+::rtl::OUString aAuthorToShow;
+::rtl::OUString aComment;
 ScRangeList aRangeList;
 ScChgsDateMode  eDateMode;
 sal_BoolbShowIt;
@@ -108,16 +107,16 @@ public:
 sal_BoolHasAuthor() const {return bIsAuthor;}
 voidSetHasAuthor(sal_Bool nFlag=sal_True) 
{bIsAuthor=nFlag;}
 
-String  GetTheAuthorToShow()const {return aAuthorToShow;}
-voidSetTheAuthorToShow(const String& 
aString){aAuthorToShow=aString;}
+::rtl::OUString GetTheAuthorToShow()const {return aAuthorToShow;}
+voidSetTheAuthorToShow(const ::rtl::OUString& 
aString){aAuthorToShow=aString;}
 
 sal_BoolHasComment() const {return bIsComment;}
 voidSetHasComment(sal_Bool nFlag=sal_True) 
{bIsComment=nFlag;}
 
-String  GetTheComment()const {return aComment;}
-voidSetTheComment(const String& aString);
+::rtl::OUString GetTheComment()const {return aComment;}
+voidSetTheComment(const ::rtl::OUString& aString);
 
-sal_BoolIsValidComment(const String* pCommentStr) const;
+sal_BoolIsValidComment(const ::rtl::OUString* pCommentStr) 
const;
 
 sal_BoolIsEveryoneButMe() const {return bEveryoneButMe;}
 voidSetEveryoneButMe(sal_Bool nFlag=sal_True) 
{bEveryoneButMe=nFlag;}
diff --git a/sc/source/core/tool/chgviset.cxx b/sc/source/core/tool/chgviset.cxx
index 061f662..fdd1678 100644
--- a/sc/source/core/tool/chgviset.cxx
+++ b/sc/source/core/tool/chgviset.cxx
@@ -89,21 +89,20 @@ ScChangeViewSettings& ScChangeViewSettings::operator=( 
const ScChangeViewSetting
 return *this;
 }
 
-sal_Bool ScChangeViewSettings::IsValidComment(const String* pCommentStr) const
+sal_Bool ScChangeViewSettings::IsValidComment(const ::rtl::OUString* 
pCommentStr) const
 {
 sal_Bool nTheFlag=sal_True;
 
 if(pCommentSearcher!=NULL)
 {
-xub_StrLen nStartPos = 0;
-xub_StrLen nEndPos = pCommentStr->Len();
-
-nTheFlag=sal::static_int_cast(pCommentSearcher->SearchFrwrd( 
*pCommentStr, &nStartPos, &nEndPos));
+sal_Int32 nStartPos = 0;
+sal_Int32 nEndPos = pCommentStr->getLength();
+nTheFlag=pCommentSearcher->SearchForward(*pCommentStr, &nStartPos, 
&nEndPos);
 }
 return nTheFlag;
 }
 
-void ScChangeViewSettings::SetTheComment(const String& rString)
+void ScChangeViewSettings::SetTheComment(const ::rtl::OUString& rString)
 {
 aComment=rString;
 if(pCommentSearcher!=NULL)
@@ -112,7 +111,7 @@ void ScChangeViewSettings::SetTheComment(const String& 
rString)
 pCommentSearcher=NULL;
 }
 
-if(rString.Len()>0)
+if(!rString.isEmpty())
 {
 utl::SearchParam aSearchParam( rString,
 utl::SearchParam::SRCH_REGEXP,false,false,false );
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 74bcb89..574d1c6 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -179,7 +179,7 @@ sal_Bool ScViewUtil::IsActionShown( const ScChangeAction& 
rAction,
 rAction.GetDescription(aTmp, &rDocument);
 aBuf.append(aTmp);
 aBuf.append(sal_Unicode(')'));
-String aComStr = aBuf.makeStringAndClear();
+rtl::OUString aComStr = aBuf.makeStringAndClear();
 
 if(!rSettings.IsValidComment(&aComStr))
 return false;
diff --git a/unotools/inc/unotools/textsearch.hxx 
b/unotools/inc/unotools/textsearch.hxx
index 58e49aa..1f955bc 100644
--- a/unotools/inc/unotools/textsearch.hxx
+++ b/unotools/inc/unotools/textsearch.hxx
@@ -159,6 +159,9 @@ public:
 

[Libreoffice-commits] .: sc/inc sc/source

2012-07-05 Thread Eike Rathke
 sc/inc/cell.hxx|8 
 sc/inc/formularesult.hxx   |   12 +++-
 sc/source/filter/excel/excform.cxx |2 +-
 3 files changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 757a346159dd51ae65767bce98a12826fef179b6
Author: Eike Rathke 
Date:   Thu Jul 5 20:26:20 2012 +0200

resolved fdo#51664 some matrix cases broken in binary Excel import

Import (ab)used ScFormulaCell::SetHybridDouble() in the sense that
actually it is not a hybrid (no formula string, the token array is
present in binary import) and during interpretation a matrix was
expected but instead the hybrid encountered.

Introduced ScFormulaCell::SetResultDouble() for exactly this case as a
workaround.

Change-Id: I4da3812ef4974380224b5a2bf42d0b62c14d121b

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 1717d8d..f609a46 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -500,6 +500,14 @@ public:
 voidSetHybridFormula( const rtl::OUString& r,
 const formula::FormulaGrammar::Grammar 
eGrammar )
 { aResult.SetHybridFormula( r); eTempGrammar = 
eGrammar; }
+
+/** For import only: set a double result.
+Use this instead of SetHybridDouble() if there is no (temporary)
+formula string because the formula is present as a token array, as it
+is the case for binary Excel import.
+ */
+voidSetResultDouble( double n ) { aResult.SetDouble( n); }
+
 voidSetErrCode( sal_uInt16 n );
 inline bool IsHyperLinkCell() const { return pCode && 
pCode->IsHyperLink(); }
 EditTextObject* CreateURLObject() ;
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index 2983176..e0f586c 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -151,11 +151,13 @@ public:
 void SetResultError( sal_uInt16 nErr );
 
 /** Set direct double. Shouldn't be used externally except in
-ScFormulaCell for rounded CalcAsShown or SetErrCode(). If
-ScMatrixFormulaCellToken the token isn't replaced but upper left result
-is modified instead, but only if it was of type formula::svDouble 
before or not
-set at all. */
-void SetDouble( double f );
+ScFormulaCell for rounded CalcAsShown or SetErrCode() or
+SetResultDouble(), see there for condition. If
+ScMatrixFormulaCellToken the token isn't replaced but upper
+left result is modified instead, but only if it was of type
+formula::svDouble before or not set at all.
+ */
+SC_DLLPUBLIC void SetDouble( double f );
 
 /** Return value if type formula::svDouble or formula::svHybridCell or 
formula::svMatrixCell and upper
 left formula::svDouble, else 0.0 */
diff --git a/sc/source/filter/excel/excform.cxx 
b/sc/source/filter/excel/excform.cxx
index 4fcf976..416d46f 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -160,7 +160,7 @@ void ImportExcel::Formula(
 ExcelToSc::SetError( *pCell, eErr );
 
 if (!rtl::math::isNan(fCurVal))
-pCell->SetHybridDouble(fCurVal);
+pCell->SetResultDouble(fCurVal);
 }
 
 GetXFRangeBuffer().SetXF( aScPos, nXF );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-07-05 Thread Kohei Yoshida
 sc/inc/dpcachetable.hxx|6 +++
 sc/inc/dpgroup.hxx |1 
 sc/inc/dpobject.hxx|6 +++
 sc/inc/dpsave.hxx  |5 ++
 sc/inc/dpsdbtab.hxx|1 
 sc/inc/dpshttab.hxx|1 
 sc/inc/dptabdat.hxx|1 
 sc/source/core/data/dpgroup.cxx|5 ++
 sc/source/core/data/dpobject.cxx   |   17 +
 sc/source/core/data/dpsave.cxx |   65 +
 sc/source/core/data/dpsdbtab.cxx   |5 ++
 sc/source/core/data/dpshttab.cxx   |5 ++
 sc/source/ui/docshell/dbdocfun.cxx |1 
 13 files changed, 119 insertions(+)

New commits:
commit fa2b7eff2d40b6455970b521306c5961e4e3cec4
Author: Kohei Yoshida 
Date:   Thu Jul 5 11:17:19 2012 -0400

fdo#51266: Sync dimension members in several places upon refresh.

Or else the pivot table would generate erroneous results or crash
after refresh.

Change-Id: Ia14a6e3d25112e6ecd62d21928639f75e6a8ba7c

diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index f104d3b..d834910 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -56,6 +56,12 @@ class ScRange;
 struct ScDPValueData;
 struct ScQueryParam;
 
+/**
+ * Despite the name, this class is only a wrapper to the actual cache, to
+ * provide filtering on the raw data based on the query filter and/or page
+ * field filters. I will rename this class to a more appropriate name in the
+ * future.
+ */
 class SC_DLLPUBLIC ScDPCacheTable
 {
 struct RowFlag
diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx
index 4bf9972..5d48af0 100644
--- a/sc/inc/dpgroup.hxx
+++ b/sc/inc/dpgroup.hxx
@@ -182,6 +182,7 @@ public:
  
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< 
::com::sun::star::uno::Any > >& rData);
 virtual voidCalcResults(CalcInfo& rInfo, bool 
bAutoShow);
 virtual const ScDPCacheTable&   GetCacheTable() const;
+virtual void ClearCacheTable();
 
 virtual sal_BoolIsBaseForGroup(long nDim) const;
 virtual longGetGroupBase(long nGroupDim) const;
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index da0fc09..e163ef1 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -239,6 +239,12 @@ public:
 
 voidBuildAllDimensionMembers();
 
+/**
+ * Remove in the save data entries for members that don't exist anymore.
+ * This is called during pivot table refresh.
+ */
+void SyncAllDimensionMembers();
+
 static bool HasRegisteredSources();
 static com::sun::star::uno::Sequence GetRegisteredSources();
 static 
com::sun::star::uno::Reference
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index c4df4ed..28bfafd 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -33,6 +33,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -122,6 +123,7 @@ private:
 ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pLayoutInfo; // (level)
 
 public:
+typedef boost::unordered_set 
MemberSetType;
 typedef boost::unordered_map  MemberHash;
 typedef std::list  MemberList;
 
@@ -230,6 +232,8 @@ public:
 void UpdateMemberVisibility(const ::boost::unordered_map< ::rtl::OUString, 
bool, ::rtl::OUStringHash>& rData);
 
 bool HasInvisibleMember() const;
+
+void RemoveObsoleteMembers(const MemberSetType& rMembers);
 };
 
 
@@ -344,6 +348,7 @@ public:
 SC_DLLPUBLIC ScDPDimensionSaveData* GetDimensionData(); // create if not 
there
 void SetDimensionData( const ScDPDimensionSaveData* pNew ); // copied
 void BuildAllDimensionMembers(ScDPTableData* pData);
+void SyncAllDimensionMembers(ScDPTableData* pData);
 
 /**
  * Check whether a dimension has one or more invisible members.
diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx
index eba6da2..a96b011 100644
--- a/sc/inc/dpsdbtab.hxx
+++ b/sc/inc/dpsdbtab.hxx
@@ -88,6 +88,7 @@ public:
  
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< 
::com::sun::star::uno::Any > >& rData);
 virtual voidCalcResults(CalcInfo& rInfo, bool 
bAutoShow);
 virtual const ScDPCacheTable&   GetCacheTable() const;
+virtual void ClearCacheTable();
 };
 
 
diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index 3a0fcb3..510105d 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -128,6 +128,7 @@ public:
  
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< 
::com::sun::star::uno::Any > >& rData);
 virtual voidCalcResults(CalcInfo& rInfo, bool 
bAutoShow);
 virtual const ScDPCacheTable&   GetCacheTable() const;
+virtual void ClearCacheTable();
 };
 
 
diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx
index 1bbc4d6..f19a6ba 1006

[Libreoffice-commits] .: sc/inc sc/source

2012-07-03 Thread Kohei Yoshida
 sc/inc/dpitemdata.hxx  |1 +
 sc/source/core/data/dpcache.cxx|2 ++
 sc/source/core/data/dpitemdata.cxx |6 ++
 3 files changed, 9 insertions(+)

New commits:
commit f2ac4ff6600a7d20a519e9ef9e6bcd8157288f63
Author: Kohei Yoshida 
Date:   Tue Jul 3 14:08:14 2012 -0400

fdo#51266: Properly set pivot item 'empty' on empty cells.

Or else it would re-use the last non-empty cell value which is wrong.

Change-Id: I3feab09a54e93150a7b6a9e9b4b540327f2ab5c5

diff --git a/sc/inc/dpitemdata.hxx b/sc/inc/dpitemdata.hxx
index 67f4af2..e294de8 100644
--- a/sc/inc/dpitemdata.hxx
+++ b/sc/inc/dpitemdata.hxx
@@ -89,6 +89,7 @@ public:
 ~ScDPItemData();
 
 Type GetType() const;
+void SetEmpty();
 void SetString(const rtl::OUString& rS);
 void SetString(const rtl::OUString* pS);
 void SetValue(double fVal);
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 742b6eb..9163dde 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -161,6 +161,8 @@ void initFromCell(
 {
 rData.SetString(rCache.InternString(aDocStr));
 }
+else
+rData.SetEmpty();
 }
 
 void getItemValue(
diff --git a/sc/source/core/data/dpitemdata.cxx 
b/sc/source/core/data/dpitemdata.cxx
index 1bcc3a6..1641572 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -138,6 +138,12 @@ ScDPItemData::Type ScDPItemData::GetType() const
 return static_cast(meType);
 }
 
+void ScDPItemData::SetEmpty()
+{
+DisposeString();
+meType = Empty;
+}
+
 void ScDPItemData::SetString(const rtl::OUString& rS)
 {
 DisposeString();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-06-25 Thread Eike Rathke
 sc/inc/compiler.hxx  |7 +++
 sc/source/core/tool/compiler.cxx |8 
 sc/source/core/tool/token.cxx|   19 +++
 3 files changed, 34 insertions(+)

New commits:
commit 1135bfd78802e5c40ca09bcbc75d0908a423872a
Author: Eike Rathke 
Date:   Tue Jun 26 02:05:09 2012 +0200

fdo#46338 preserve sheet name input of invalid reference

If sheet name doesn't exist the resulting reference had replaced the
sheet name with #REF!, e.g. #REF!.A1, because the actual sheet name is
not part of the reference. From a syntactically valid but otherwise
invalid non-external reference create an ocBad token instead to preserve
the sheet name.

Currently a #NAME? error instead of #REF! is generated, further work
would be needed to pass specific error values with ocBad.

Change-Id: I5a608a74d3b3ff2baa4967f2b2e3078cfecfbabc

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 58a3c6c..470d8eb 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -196,6 +196,13 @@ public:
 void SetMatrix( ScMatrix* p );
 void SetExternal(const sal_Unicode* pStr);
 
+/** If the token is a non-external reference, determine if the reference is
+valid. If the token is an external reference, return true. Else return
+false. Used only in ScCompiler::NextNewToken() to preserve non-existing
+sheet names in otherwise valid references.
+ */
+bool IsValidReference() const;
+
 ScRawToken* Clone() const;  // real copy!
 formula::FormulaToken* CreateToken() const;   // create typified token
 void Load( SvStream&, sal_uInt16 nVer );
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 97ae770..dc30ff8 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3657,6 +3657,14 @@ bool ScCompiler::NextNewToken( bool bInArray )
 {
 if (mbRewind)   // Range operator, but no direct reference.
 continue;   // do; up to range operator.
+// If a syntactically correct reference was recognized but invalid
+// e.g. because of non-existing sheet name => entire reference
+// ocBad to preserve input instead of #REF!.A1
+if (!pRawToken->IsValidReference())
+{
+aUpper = aOrg;  // ensure for ocBad
+break;  // do; create ocBad token or set error.
+}
 return true;
 }
 
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 800d952..99b0713 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -292,6 +292,25 @@ void ScRawToken::SetExternal( const sal_Unicode* pStr )
 nRefCnt = 0;
 }
 
+
+bool ScRawToken::IsValidReference() const
+{
+switch (eType)
+{
+case svSingleRef:
+return aRef.Ref1.Valid();
+case svDoubleRef:
+return aRef.Valid();
+case svExternalSingleRef:
+case svExternalDoubleRef:
+return true;
+default:
+;   // nothing
+}
+return false;
+}
+
+
 sal_uInt16 lcl_ScRawTokenOffset()
 {
 // offset of sbyte in ScRawToken
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-06-20 Thread Michael Stahl
 sc/inc/cellsuno.hxx  |7 ++---
 sc/source/ui/unoobj/cellsuno.cxx |   49 +--
 2 files changed, 35 insertions(+), 21 deletions(-)

New commits:
commit 0e73f3cbe116ac949264482525167eb750835da9
Author: Michael Stahl 
Date:   Wed Jun 20 21:33:42 2012 +0200

move ScNamedEntryArr_Impl out of header to make MSVC happy

Change-Id: Ia521752c4c71cc7df2bb7fc4659fcf6ec528e5bc

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 0ad91f9..78a32c1 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -100,6 +100,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -130,9 +131,6 @@ typedef ::com::sun::star::uno::Reference<
 ::com::sun::star::util::XModifyListener > XModifyListenerRef;
 typedef boost::ptr_vector XModifyListenerArr_Impl;
 
-class ScNamedEntry;
-typedef boost::ptr_vector ScNamedEntryArr_Impl;
-
 
 //  ScCellRangesBase - base class for ScCellRangesObj (with access by index)
 //and ScCellRangeObj  (without access by index)
@@ -497,7 +495,8 @@ class SC_DLLPUBLIC ScCellRangesObj : public 
ScCellRangesBase,
 public com::sun::star::container::XEnumerationAccess
 {
 private:
-ScNamedEntryArr_ImplaNamedEntries;
+struct Impl;
+::boost::scoped_ptr m_pImpl;
 
 ScCellRangeObj* GetObjectByIndex_Impl(sal_Int32 nIndex) const;
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index af0e460..4781941 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -4183,8 +4183,16 @@ ScCellRangesBase* ScCellRangesBase::getImplementation( 
const uno::Reference ScNamedEntryArr_Impl;
+
+struct ScCellRangesObj::Impl
+{
+ScNamedEntryArr_Impl m_aNamedEntries;
+};
+
+ScCellRangesObj::ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR)
+: ScCellRangesBase(pDocSh, rR)
+, m_pImpl(new Impl)
 {
 }
 
@@ -4384,7 +4392,7 @@ void SAL_CALL ScCellRangesObj::removeRangeAddress( const 
table::CellRangeAddress
 if (aMarkData.IsAllMarked( aRange ) )
 {
 aMarkData.SetMultiMarkArea( aRange, false );
-lcl_RemoveNamedEntry(aNamedEntries, aRange);
+lcl_RemoveNamedEntry(m_pImpl->m_aNamedEntries, aRange);
 }
 else
 throw container::NoSuchElementException();
@@ -4467,10 +4475,12 @@ void SAL_CALL ScCellRangesObj::insertByName( const 
rtl::OUString& aName, const u
 String aNamStr(aName);
 if ( aNamStr.Len() )
 {
-sal_uInt16 nNamedCount = aNamedEntries.size();
-for (sal_uInt16 n=0; nm_aNamedEntries.size();
+for (size_t n = 0; n < nNamedCount; n++)
+{
+if (m_pImpl->m_aNamedEntries[n].GetName() == aNamStr)
 throw container::ElementExistException();
+}
 }
 
 ScRangeList aNew(GetRangeList());
@@ -4485,10 +4495,10 @@ void SAL_CALL ScCellRangesObj::insertByName( const 
rtl::OUString& aName, const u
 {
 //  if a name is given, also insert into list of named entries
 //  (only possible for a single range)
-//  name is not in aNamedEntries (tested above)
+//  name is not in m_pImpl->m_aNamedEntries (tested above)
 
 ScNamedEntry* pEntry = new ScNamedEntry( aNamStr, *rAddRanges[ 
0 ] );
-aNamedEntries.push_back( pEntry );
+m_pImpl->m_aNamedEntries.push_back(pEntry);
 }
 }
 }
@@ -4598,14 +4608,14 @@ void SAL_CALL ScCellRangesObj::removeByName( const 
rtl::OUString& aName )
 //  deselect any ranges (parsed or named entry)
 ScRangeList aDiff;
 sal_Bool bValid = ( aDiff.Parse( aNameStr, pDocSh->GetDocument() ) & 
SCA_VALID ) != 0;
-if ( !bValid && !aNamedEntries.empty() )
+if (!bValid && !m_pImpl->m_aNamedEntries.empty())
 {
-sal_uInt16 nCount = aNamedEntries.size();
+sal_uInt16 nCount = m_pImpl->m_aNamedEntries.size();
 for (sal_uInt16 n=0; nm_aNamedEntries[n].GetName() == aNameStr)
 {
 aDiff.RemoveAll();
-aDiff.Append( aNamedEntries[n].GetRange() );
+aDiff.Append(m_pImpl->m_aNamedEntries[n].GetRange());
 bValid = sal_True;
 }
 }
@@ -4629,8 +4639,8 @@ void SAL_CALL ScCellRangesObj::removeByName( const 
rtl::OUString& aName )
 }
 }
 
-if (!aNamedEntries.empty())
-lcl_RemoveNamedEntry( aNamedEntries, aNameStr );//  remove named 
entry
+if (!m_pImpl->m_aNamedEntries.empty())
+lcl_RemoveNamedEntry(m_pImpl->m_aNamedEntries, aNameStr);
 
 if (!bDone)
 throw container::NoSuchElementException();  // not found
@@ -4661,7 +4671,8 @@ uno::Any SAL_CALL ScCellRange

[Libreoffice-commits] .: sc/inc sc/source

2012-06-11 Thread Markus Mohrhard
 sc/inc/colorscale.hxx |2 +
 sc/source/core/data/colorscale.cxx|9 +
 sc/source/ui/condformat/colorformat.cxx   |   54 +++---
 sc/source/ui/condformat/condformatdlg.cxx |   36 
 sc/source/ui/inc/colorformat.hrc  |2 +
 sc/source/ui/inc/colorformat.hxx  |3 +
 sc/source/ui/src/colorformat.src  |6 ++-
 7 files changed, 106 insertions(+), 6 deletions(-)

New commits:
commit 56de6cce83701f003416ad91b28c0dbca3a3d67e
Author: Markus Mohrhard 
Date:   Tue Jun 12 07:48:41 2012 +0200

small improvements to data bar dialog

Change-Id: I7eada5e24047d36c1625aa082ecc9e5d52f785ae

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 8e9c377..72349dc 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -80,6 +80,8 @@ public:
 void SetMax(bool bMax);
 void SetPercent(bool bPercent);
 void SetPercentile(bool bPercentile);
+
+void SetHasValue();
 };
 
 namespace databar
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index e6a5c8d..c677397 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -242,6 +242,15 @@ void ScColorScaleEntry::SetPercentile(bool bPercentile)
 mbPercentile = bPercentile;
 }
 
+void ScColorScaleEntry::SetHasValue()
+{
+mbPercentile = false;
+mbPercent = false;
+mbMin = false;
+mbMax = false;
+mpCell.reset();
+}
+
 namespace {
 
 double getMinValue(const ScRange& rRange, ScDocument* pDoc)
diff --git a/sc/source/ui/condformat/colorformat.cxx 
b/sc/source/ui/condformat/colorformat.cxx
index de45815..2483364 100644
--- a/sc/source/ui/condformat/colorformat.cxx
+++ b/sc/source/ui/condformat/colorformat.cxx
@@ -105,12 +105,12 @@ void GetType(const ListBox& rLstBox, const Edit& rEd, 
ScColorScaleEntry* pEntry
 pEntry->SetValue(nVal);
 break;
 case 4:
-//FIXME
-break;
-case 5:
 nVal = rtl::math::stringToDouble(rEd.GetText(), '.', ',');
+pEntry->SetHasValue();
 pEntry->SetValue(nVal);
 break;
+case 5:
+break;
 }
 }
 
@@ -146,7 +146,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, 
const ScDataBarForma
 maLbTypeMax( this, ScResId( LB_TYPE ) ),
 maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ),
 maEdMin( this, ScResId( ED_MIN ) ),
-maEdMax( this, ScResId( ED_MAX ) )
+maEdMax( this, ScResId( ED_MAX ) ),
+maStrWarnSameValue( SC_RESSTR( STR_WARN_SAME_VALUE ) )
 {
 Init();
 FreeResource();
@@ -171,6 +172,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, 
const ScDataBarForma
 ::SetType(rData.mpUpperLimit.get(), maLbTypeMax);
 SetValue(rData.mpLowerLimit.get(), maEdMin);
 SetValue(rData.mpUpperLimit.get(), maEdMax);
+
+TypeSelectHdl(NULL);
 }
 
 ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, ScDataBarFormat* 
pFormat):
@@ -193,7 +196,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, 
ScDataBarFormat* pFo
 maLbTypeMax( this, ScResId( LB_TYPE ) ),
 maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ),
 maEdMin( this, ScResId( ED_MIN ) ),
-maEdMax( this, ScResId( ED_MAX ) )
+maEdMax( this, ScResId( ED_MAX ) ),
+maStrWarnSameValue( SC_RESSTR( STR_WARN_SAME_VALUE ) )
 {
 Init();
 FreeResource();
@@ -265,6 +269,10 @@ void ScDataBarSettingsDlg::Init()
 Point aPoint = maLbTypeMax.GetPosPixel();
 aPoint.Y() += 50;
 maLbTypeMax.SetPosPixel(aPoint);
+
+maLbTypeMin.SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl 
) );
+maLbTypeMax.SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl 
) );
+
 }
 
 namespace {
@@ -329,6 +337,8 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl )
 if(bWarn)
 {
 //show warning message and don't close
+WarningBox aWarn(this, WB_OK, maStrWarnSameValue );
+aWarn.Execute();
 }
 else
 {
@@ -337,4 +347,38 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl )
 return 0;
 }
 
+IMPL_LINK_NOARG( ScDataBarSettingsDlg, TypeSelectHdl )
+{
+sal_Int32 nSelectMin = maLbTypeMin.GetSelectEntryPos();
+if( nSelectMin == 0 || nSelectMin == 1)
+maEdMin.Disable();
+else
+{
+maEdMin.Enable();
+if(!maEdMin.GetText().Len())
+{
+if(nSelectMin == 2 || nSelectMin == 3)
+
maEdMin.SetText(rtl::OUString::valueOf(static_cast(50)));
+else
+
maEdMin.SetText(rtl::OUString::valueOf(static_cast(0)));
+}
+}
+
+sal_Int32 nSelectMax = maLbTypeMax.GetSelectEntryPos();
+if(nSelectMax == 0 || nSelectMax == 1)
+maEdMax.Disable();
+else
+{
+maEdMax.Enable();
+if(!maEdMax.GetText().Len())
+{
+if(nSelectMax == 2 || nSelectMax == 3)
+
maEdMax

[Libreoffice-commits] .: sc/inc sc/source

2012-06-11 Thread Markus Mohrhard
 sc/inc/colorscale.hxx |2 +-
 sc/source/ui/condformat/condformatdlg.cxx |1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit a3451df90e0db9d37a7c6950c2eea53a96616e12
Author: Markus Mohrhard 
Date:   Tue Jun 12 05:25:28 2012 +0200

seems like windows does not like that

Change-Id: I3c694af4554f984274e179739475077c46db4028

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index e93d5b6..8e9c377 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -85,7 +85,7 @@ public:
 namespace databar
 {
 
-enum SC_DLLPUBLIC ScAxisPostion
+enum ScAxisPostion
 {
 NONE,
 AUTOMATIC,
diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index bc958da..54d5ba1 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -870,7 +870,6 @@ IMPL_LINK_NOARG( ScCondFrmtEntry, ConditionTypeSelectHdl )
 {
 if(maLbCondType.GetSelectEntryPos() == 6 || 
maLbCondType.GetSelectEntryPos() == 7)
 {
-std::cout << "OldSize: " << maEdVal1.GetSizePixel().Width() << " " << 
maEdVal1.GetSizePixel().Height() << std::endl;
 maEdVal1.SetSizePixel(maEdVal2.GetSizePixel());
 maEdVal2.Show();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-06-06 Thread Kohei Yoshida
 sc/inc/queryparam.hxx  |   10 +-
 sc/source/core/data/table3.cxx |8 
 sc/source/core/tool/queryparam.cxx |   10 ++
 3 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit 237e4f52abefc3714accef79deae976f634e04ec
Author: Kohei Yoshida 
Date:   Wed Jun 6 16:46:03 2012 -0400

Use iterators over index access.

This makes ValidQuery *slightly* faster.

Change-Id: I9fff6099b597d7a8d4d5a4358099348baa657802

diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 77108ab..27d121c 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -60,10 +60,18 @@ struct ScQueryParamBase
 void FillInExcelSyntax(const rtl::OUString& aCellStr, SCSIZE nIndex);
 
 protected:
+typedef boost::ptr_vector EntriesType;
+
+public:
+typedef EntriesType::const_iterator const_iterator;
+
+const_iterator begin() const;
+const_iterator end() const;
+
+protected:
 ScQueryParamBase();
 ScQueryParamBase(const ScQueryParamBase& r);
 
-typedef boost::ptr_vector EntriesType;
 EntriesType maEntries;
 };
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 4e7e874..85354f3 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1530,14 +1530,14 @@ bool ScTable::ValidQuery(
 
 longnPos = -1;
 QueryEvaluator aEval(*pDocument, *this, rParam, pbTestEqualCondition);
-
-for (size_t i = 0; i < nEntryCount && rParam.GetEntry(i).bDoQuery; ++i)
+ScQueryParam::const_iterator it, itBeg = rParam.begin(), itEnd = 
rParam.end();
+for (it = itBeg; it != itEnd && it->bDoQuery; ++it)
 {
-const ScQueryEntry& rEntry = rParam.GetEntry(i);
+const ScQueryEntry& rEntry = *it;
 SCCOL nCol = static_cast(rEntry.nField);
 
 // we can only handle one single direct query
-if ( !pCell || i > 0 )
+if (!pCell || it != itBeg)
 pCell = GetCell(nCol, nRow);
 
 std::pair aRes(false, false);
diff --git a/sc/source/core/tool/queryparam.cxx 
b/sc/source/core/tool/queryparam.cxx
index b814b27..e6059ab 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -57,6 +57,16 @@ struct FindUnused : public std::unary_function
 
 }
 
+ScQueryParamBase::const_iterator ScQueryParamBase::begin() const
+{
+return maEntries.begin();
+}
+
+ScQueryParamBase::const_iterator ScQueryParamBase::end() const
+{
+return maEntries.end();
+}
+
 ScQueryParamBase::ScQueryParamBase() :
 bHasHeader(true),
 bByRow(true),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source unusedcode.easy

2012-05-24 Thread Julien Nabet
 sc/inc/dbdata.hxx  |1 -
 sc/source/core/tool/dbdata.cxx |7 ---
 unusedcode.easy|1 -
 3 files changed, 9 deletions(-)

New commits:
commit 405ed562c9fa19d9fcf71e426739fcb022f9719e
Author: Julien Nabet 
Date:   Fri May 25 07:43:42 2012 +0200

Drop unused function "findByTable"

Change-Id: I396bd5a6eb9ecc123529259f668f98be4b4245ca

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index f770deb..538ea9e 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -213,7 +213,6 @@ public:
 const_iterator end() const;
 const ScDBData* findAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool 
bStartOnly) const;
 const ScDBData* findByRange(const ScRange& rRange) const;
-const ScDBData* findByTable(SCTAB nTab) const;
 ScDBData* getByRange(const ScRange& rRange);
 void insert(ScDBData* p);
 void erase(iterator itr);
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 60e6d28..32b15c7 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -808,13 +808,6 @@ const ScDBData* ScDBCollection::AnonDBs::findByRange(const 
ScRange& rRange) cons
 return itr == maDBs.end() ? NULL : &(*itr);
 }
 
-const ScDBData* ScDBCollection::AnonDBs::findByTable(SCTAB nTab) const
-{
-DBsType::const_iterator itr = find_if(
-maDBs.begin(), maDBs.end(), FindFilterDBByTable(nTab));
-return itr == maDBs.end() ? NULL : &(*itr);
-}
-
 ScDBData* ScDBCollection::AnonDBs::getByRange(const ScRange& rRange)
 {
 const ScDBData* pData = findByRange(rRange);
diff --git a/unusedcode.easy b/unusedcode.easy
index 4ad7d19..11dec4a 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -40,7 +40,6 @@ ScCompressedArray::ScCompressedArray(int, unsigned short co
 ScCompressedArray::SetValue(int, unsigned short const&)
 ScCsvControl::ScCsvControl(Window*, ScCsvLayoutData const&, long)
 
ScDBCollection::AnonDBs::erase(boost::void_ptr_iterator<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator > >, 
std::__debug::vector > >, ScDBData>)
-ScDBCollection::AnonDBs::findByTable(short) const
 ScDPLabelData::ScDPLabelData(rtl::OUString const&, short, bool)
 ScHTMLColOffset::Insert(ScHTMLColOffset const*, unsigned short, unsigned short)
 ScHTMLColOffset::Insert(unsigned long const&, unsigned short&)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-05-21 Thread Markus Mohrhard
 sc/inc/colorscale.hxx |8 ++
 sc/source/core/data/colorscale.cxx|  106 ++
 sc/source/filter/inc/condformatbuffer.hxx |4 -
 sc/source/filter/oox/condformatbuffer.cxx |   10 +-
 4 files changed, 109 insertions(+), 19 deletions(-)

New commits:
commit f654980aebb5d41a83dd7de94ec2ebf0173c67a7
Author: Markus Mohrhard 
Date:   Mon May 21 15:47:23 2012 +0200

initial support for percentile in data bars/color scales

Color Scales look correctly but in the databar code seems to be an error
if all values are positive.

Change-Id: I0bfb277df50021bd20a4b13a5da342670102b649

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 997c2a0..9f4d02f 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -32,6 +32,8 @@
 #include 
 #include 
 
+#include 
+
 //TODO: merge this with conditio.hxx
 
 class ScDocument;
@@ -49,6 +51,7 @@ private:
 bool mbMin;
 bool mbMax;
 bool mbPercent;
+bool mbPercentile;
 public:
 ScColorScaleEntry(double nVal, const Color& rCol);
 ScColorScaleEntry(const ScColorScaleEntry& rEntry);
@@ -65,11 +68,13 @@ public:
 bool GetMin() const;
 bool GetMax() const;
 bool GetPercent() const;
+bool GetPercentile() const;
 bool HasFormula() const;
 const ScTokenArray* GetFormula() const;
 void SetMin(bool bMin);
 void SetMax(bool bMax);
 void SetPercent(bool bPercent);
+void SetPercentile(bool bPercentile);
 };
 
 namespace databar
@@ -160,6 +165,8 @@ public:
 virtual ScColorFormatType GetType() const = 0;
 
 protected:
+void getValues( std::vector& rValues ) const;
+
 ScRangeList maRanges;
 ScDocument* mpDoc;
 };
@@ -175,6 +182,7 @@ private:
 
 void calcMinMax(double& nMin, double& nMax) const;
 bool CheckEntriesForRel(const ScRange& rRange) const;
+double CalcValue(double nMin, double nMax, 
ColorScaleEntries::const_iterator& rItr) const;
 public:
 ScColorScaleFormat(ScDocument* pDoc);
 ScColorScaleFormat(ScDocument* pDoc, const ScColorScaleFormat& rFormat);
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 8306107..9636365 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -37,7 +37,8 @@ ScColorScaleEntry::ScColorScaleEntry(double nVal, const 
Color& rCol):
 mpCell(NULL),
 mbMin(false),
 mbMax(false),
-mbPercent(false)
+mbPercent(false),
+mbPercentile(false)
 {
 }
 
@@ -47,7 +48,8 @@ ScColorScaleEntry::ScColorScaleEntry(const ScColorScaleEntry& 
rEntry):
 mpCell(),
 mbMin(rEntry.mbMin),
 mbMax(rEntry.mbMax),
-mbPercent(rEntry.mbPercent)
+mbPercent(rEntry.mbPercent),
+mbPercentile(rEntry.mbPercentile)
 {
 }
 
@@ -57,7 +59,8 @@ ScColorScaleEntry::ScColorScaleEntry(ScDocument* pDoc, const 
ScColorScaleEntry&
 mpCell(),
 mbMin(rEntry.mbMin),
 mbMax(rEntry.mbMax),
-mbPercent(rEntry.mbPercent)
+mbPercent(rEntry.mbPercent),
+mbPercentile(rEntry.mbPercentile)
 {
 if(rEntry.mpCell)
 {
@@ -179,6 +182,11 @@ bool ScColorScaleEntry::GetPercent() const
 return mbPercent;
 }
 
+bool ScColorScaleEntry::GetPercentile() const
+{
+return mbPercentile;
+}
+
 bool ScColorScaleEntry::HasFormula() const
 {
 return mpCell;
@@ -199,6 +207,11 @@ void ScColorScaleEntry::SetPercent(bool bPercent)
 mbPercent = bPercent;
 }
 
+void ScColorScaleEntry::SetPercentile(bool bPercentile)
+{
+mbPercentile = bPercentile;
+}
+
 namespace {
 
 double getMinValue(const ScRange& rRange, ScDocument* pDoc)
@@ -336,6 +349,37 @@ const ScRangeList& ScColorFormat::GetRange() const
 return maRanges;
 }
 
+void ScColorFormat::getValues(std::vector& rValues) const
+{
+size_t n = maRanges.size();
+for(size_t i = 0; i < n; ++i)
+{
+const ScRange* pRange = maRanges[i];
+SCTAB nTab = pRange->aStart.Tab();
+for(SCCOL nCol = pRange->aStart.Col(); nCol <= pRange->aEnd.Col(); 
++nCol)
+{
+for(SCCOL nRow = pRange->aStart.Row(); nRow <= pRange->aEnd.Row(); 
++nRow)
+{
+ScAddress aAddr(nCol, nRow, nTab);
+CellType eType = mpDoc->GetCellType(aAddr);
+if(eType == CELLTYPE_VALUE)
+{
+double aVal = mpDoc->GetValue(nCol, nRow, nTab);
+rValues.push_back(aVal);
+}
+else if(eType == CELLTYPE_FORMULA)
+{
+
if(static_cast(mpDoc->GetCell(aAddr))->IsValue())
+{
+double aVal = mpDoc->GetValue(nCol, nRow, nTab);
+rValues.push_back(aVal);
+}
+}
+}
+}
+}
+}
+
 namespace {
 
 sal_uInt8 GetColorValue( double nVal, double nVal1, sal_uInt8 nColVal1, double 
nVal2, sal_uInt8 nColVal2 )
@@ -359,7 +403,27 @@ Color CalcColor( double nVal, d

[Libreoffice-commits] .: sc/inc sc/source

2012-05-18 Thread Kohei Yoshida
 sc/inc/cell.hxx|3 
 sc/inc/column.hxx  |8 +-
 sc/source/core/data/cell2.cxx  |   10 ++-
 sc/source/core/data/column.cxx |  130 +
 4 files changed, 106 insertions(+), 45 deletions(-)

New commits:
commit 1735044e9f693cde1af0d905d264c849e3fce311
Author: Kohei Yoshida 
Date:   Fri May 18 12:09:54 2012 -0400

Adjust sheet fields in cells when sheet structure changes.

Change-Id: I0aff738968e286df57ef7dd5b67780108cdc6c89

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 3bf2dfe..de4d1ad 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -258,6 +258,9 @@ public:
 
 /** Removes character attribute based on new pattern attributes. */
 voidRemoveCharAttribs( const ScPatternAttr& rAttr );
+
+/** Update field items if any. */
+void UpdateFields(SCTAB nTab);
 };
 
 class ScEditDataArray
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 4988ffc..446f4de 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -281,9 +281,9 @@ public:
  SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
  SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
  ScDocument* pUndoDoc = NULL );
-voidUpdateInsertTab( SCTAB nTable, SCTAB nNewSheets = 1);
-voidUpdateInsertTabOnlyCells( SCTAB nTable, SCTAB nNewSheets = 1);
-voidUpdateDeleteTab( SCTAB nTable, bool bIsMove, ScColumn* 
pRefUndo = NULL, SCTAB nSheets = 1 );
+void UpdateInsertTab(SCTAB nInsPos, SCTAB nNewSheets = 1);
+void UpdateInsertTabOnlyCells(SCTAB nInsPos, SCTAB nNewSheets = 1);
+void UpdateDeleteTab(SCTAB nDelPos, bool bIsMove, ScColumn* pRefUndo = 
NULL, SCTAB nSheets = 1);
 voidUpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo);
 voidUpdateCompile( bool bForceIfNameInUse = false );
 voidUpdateTranspose( const ScRange& rSource, const ScAddress& 
rDest,
@@ -373,7 +373,7 @@ public:
 void GetFilterEntries(SCROW nStartRow, SCROW nEndRow, 
std::vector& rStrings, bool& rHasDates);
 bool GetDataEntries(SCROW nRow, std::set& rStrings, bool 
bLimit);
 
-voidUpdateInsertTabAbs(SCTAB nNewPos);
+void UpdateInsertTabAbs(SCTAB nNewPos);
 boolTestTabRefAbs(SCTAB nTable);
 boolGetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& 
rData) const;
 
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index c8c6b9b..1e0dcbe 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -78,9 +78,7 @@ ScEditCell::ScEditCell(const ScEditCell& rCell, ScDocument& 
rDoc, const ScAddres
 ScBaseCell(rCell), pString(NULL), pDoc(&rDoc)
 {
 SetTextObject( rCell.pData, rCell.pDoc->GetEditPool() );
-
-editeng::FieldUpdater aUpdater = pData->GetFieldUpdater();
-aUpdater.updateTableFields(rDestPos.Tab());
+UpdateFields(rDestPos.Tab());
 }
 
 ScEditCell::ScEditCell( const rtl::OUString& rString, ScDocument* pDocP )  :
@@ -166,6 +164,12 @@ void ScEditCell::RemoveCharAttribs( const ScPatternAttr& 
rAttr )
 }
 }
 
+void ScEditCell::UpdateFields(SCTAB nTab)
+{
+editeng::FieldUpdater aUpdater = pData->GetFieldUpdater();
+aUpdater.updateTableFields(nTab);
+}
+
 void ScEditCell::SetTextObject( const EditTextObject* pObject,
 const SfxItemPool* pFromPool )
 {
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 9ae787b..eebb17a 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1668,72 +1668,102 @@ void ScColumn::UpdateGrow( const ScRange& rArea, SCCOL 
nGrowX, SCROW nGrowY )
 }
 
 
-void ScColumn::UpdateInsertTab( SCTAB nTable, SCTAB nNewSheets )
+void ScColumn::UpdateInsertTab(SCTAB nInsPos, SCTAB nNewSheets)
 {
-if (nTab >= nTable)
+if (nTab >= nInsPos)
 {
 nTab += nNewSheets;
 pAttrArray->SetTab(nTab);
 }
-if ( !maItems.empty() )
-UpdateInsertTabOnlyCells( nTable, nNewSheets );
-}
 
+UpdateInsertTabOnlyCells(nInsPos, nNewSheets);
+}
 
-void ScColumn::UpdateInsertTabOnlyCells( SCTAB nTable, SCTAB nNewSheets )
+void ScColumn::UpdateInsertTabOnlyCells(SCTAB nInsPos, SCTAB nNewSheets)
 {
-if ( !maItems.empty() )
-for (SCSIZE i = 0; i < maItems.size(); i++)
+if (maItems.empty())
+return;
+
+for (size_t i = 0; i < maItems.size(); ++i)
+{
+switch (maItems[i].pCell->GetCellType())
 {
-ScFormulaCell* pCell = (ScFormulaCell*) maItems[i].pCell;
-if( pCell->GetCellType() == CELLTYPE_FORMULA)
+case CELLTYPE_FORMULA:
 {
 SCROW nRow = maItems[i].nRow;
-pCell->UpdateInsertTab(nTable, nNewSheets);
-if ( nRow != maItems[i].nRow )
-Search( nRow, i );  // Listener geloescht/eingefuegt?
+ScFormulaCell* p = 
static_

[Libreoffice-commits] .: sc/inc sc/source

2012-05-17 Thread Kohei Yoshida
 sc/inc/sc.hrc   |4 ++--
 sc/source/ui/dbgui/filtdlg.cxx  |4 ++--
 sc/source/ui/dbgui/pfiltdlg.cxx |4 ++--
 sc/source/ui/src/scstring.src   |   20 ++--
 sc/source/ui/view/gridwin.cxx   |8 
 5 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit 87ed6c8480eaf0e5e3e89f00399fa214ba0dec6c
Author: Kohei Yoshida 
Date:   Thu May 17 17:20:04 2012 -0400

Better string values for "empty" and "non-empty" filtering option.

Change-Id: Iecfac54143676c9f0b483c4fa8deb26bf42ea16b

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 68a039c..59b6564 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -788,8 +788,8 @@
 #define SCSTR_UNDEFINED (STR_START + 8)
 #define SCSTR_NONAME(STR_START + 9)
 #define SCSTR_NONE  (STR_START + 10)
-#define SCSTR_EMPTY (STR_START + 11)
-#define SCSTR_NOTEMPTY  (STR_START + 12)
+#define SCSTR_FILTER_EMPTY  (STR_START + 11)
+#define SCSTR_FILTER_NOTEMPTY   (STR_START + 12)
 #define SCSTR_COLUMN(STR_START + 13)
 #define SCSTR_ROW   (STR_START + 14)
 #define SCSTR_NEW   (STR_START + 15)
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index cb236c6..4ee8bf6 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -115,8 +115,8 @@ ScFilterDlg::ScFilterDlg( SfxBindings* pB, SfxChildWindow* 
pCW, Window* pParent,
 aFtDbArea   ( this, ScResId( FT_DBAREA ) ),
 aStrUndefined   ( SC_RESSTR(SCSTR_UNDEFINED) ),
 aStrNone( SC_RESSTR(SCSTR_NONE) ),
-aStrEmpty   ( SC_RESSTR(SCSTR_EMPTY) ),
-aStrNotEmpty( SC_RESSTR(SCSTR_NOTEMPTY) ),
+aStrEmpty   ( SC_RESSTR(SCSTR_FILTER_EMPTY) ),
+aStrNotEmpty( SC_RESSTR(SCSTR_FILTER_NOTEMPTY) ),
 aStrRow ( SC_RESSTR(SCSTR_ROW) ),
 aStrColumn  ( SC_RESSTR(SCSTR_COLUMN) ),
 //
diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx
index ef4157f..5290291 100644
--- a/sc/source/ui/dbgui/pfiltdlg.cxx
+++ b/sc/source/ui/dbgui/pfiltdlg.cxx
@@ -90,8 +90,8 @@ ScPivotFilterDlg::ScPivotFilterDlg( Window* 
pParent,
 aBtnMore( this, ScResId( BTN_MORE ) ),
 aStrUndefined   ( SC_RESSTR(SCSTR_UNDEFINED) ),
 aStrNone( SC_RESSTR(SCSTR_NONE) ),
-aStrEmpty   ( SC_RESSTR(SCSTR_EMPTY) ),
-aStrNotEmpty( SC_RESSTR(SCSTR_NOTEMPTY) ),
+aStrEmpty   ( SC_RESSTR(SCSTR_FILTER_EMPTY) ),
+aStrNotEmpty( SC_RESSTR(SCSTR_FILTER_NOTEMPTY) ),
 aStrRow ( SC_RESSTR(SCSTR_ROW) ),
 aStrColumn  ( SC_RESSTR(SCSTR_COLUMN) ),
 //
diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src
index c770dfe..c3f3e00 100644
--- a/sc/source/ui/src/scstring.src
+++ b/sc/source/ui/src/scstring.src
@@ -166,16 +166,6 @@ String SCSTR_NONE
 Text [ en-US ] = "- none -" ;
 };
 
-String SCSTR_EMPTY
-{
-Text [ en-US ] = "- empty -" ;
-};
-
-String SCSTR_NOTEMPTY
-{
-Text [ en-US ] = "- not empty -" ;
-};
-
 String SCSTR_NEWTABLE
 {
 Text [ en-US ] = "- new sheet -" ;
@@ -196,6 +186,16 @@ String SCSTR_TOP10FILTER
 Text [ en-US ] = "Top 10" ;
 };
 
+String SCSTR_FILTER_EMPTY
+{
+Text [ en-US ] = "Empty" ;
+};
+
+String SCSTR_FILTER_NOTEMPTY
+{
+Text [ en-US ] = "Not Empty" ;
+};
+
 String SCSTR_NONAME
 {
 Text [ en-US ] = "unnamed" ;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index c0f0a38..d6edb8e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -707,11 +707,11 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 mpAutoFilterPopup->addMenuItem(
 SC_RESSTR(SCSTR_TOP10FILTER), true, new AutoFilterAction(this, Top10));
 mpAutoFilterPopup->addMenuItem(
-SC_RESSTR(SCSTR_STDFILTER), true, new AutoFilterAction(this, Custom));
+SC_RESSTR(SCSTR_FILTER_EMPTY), true, new AutoFilterAction(this, 
Empty));
 mpAutoFilterPopup->addMenuItem(
-SC_RESSTR(SCSTR_EMPTY), true, new AutoFilterAction(this, Empty));
+SC_RESSTR(SCSTR_FILTER_NOTEMPTY), true, new AutoFilterAction(this, 
NonEmpty));
 mpAutoFilterPopup->addMenuItem(
-SC_RESSTR(SCSTR_NOTEMPTY), true, new AutoFilterAction(this, NonEmpty));
+SC_RESSTR(SCSTR_STDFILTER), true, new AutoFilterAction(this, Custom));
 
 ScCheckListMenuWindow::Config aConfig;
 aConfig.mbAllowEmptySet = false;
@@ -1181,7 +1181,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, 
SCROW nRow, bool bDataSelec
 long nMaxText = 0;
 
 //  default entries
-static const sal_uInt16 nDefIDs[] = { SCSTR_ALLFILTER, 
SCSTR_TOP10FILTER, SCSTR_STDFILTER, SCSTR_EMPTY, SCSTR_NOTEMPTY };
+static const sal_uInt16 nDefIDs[] = { SCSTR_ALLFILTER, 
SCSTR_TOP10FILTER, SCSTR_STDFILTER, SCSTR_FILTER_EMPTY, SCST

[Libreoffice-commits] .: sc/inc sc/source

2012-05-11 Thread Markus Mohrhard
 sc/inc/colorscale.hxx  |2 ++
 sc/source/core/data/colorscale.cxx |   29 +
 sc/source/core/data/documen2.cxx   |2 ++
 sc/source/core/data/documen3.cxx   |3 +++
 sc/source/core/data/document.cxx   |9 +
 5 files changed, 45 insertions(+)

New commits:
commit 03ca37a3034027e9ef4cf80814994007fd595a95
Author: Markus Mohrhard 
Date:   Fri May 11 23:43:43 2012 +0200

update references in color scales

Change-Id: Ie86cbd173a21e79d802a03fd112ea01c0cf44116

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 2d5839f..54f0c59 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -56,6 +56,8 @@ public:
 double GetValue() const;
 void SetFormula(const rtl::OUString& rFormula, ScDocument* pDoc, const 
ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar = 
formula::FormulaGrammar::GRAM_DEFAULT);
 void UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab, SCTAB nTabNo);
+void UpdateReference( UpdateRefMode eUpdateRefMode,
+const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
 
 bool GetMin() const;
 bool GetMax() const;
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 728d23e..6a249ff 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -82,6 +82,15 @@ void ScColorScaleEntry::UpdateMoveTab( SCTAB nOldTab, SCTAB 
nNewTab, SCTAB nTabN
 }
 }
 
+void ScColorScaleEntry::UpdateReference( UpdateRefMode eUpdateRefMode,
+const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
+{
+if(mpCell)
+{
+mpCell->UpdateReference( eUpdateRefMode, rRange, nDx, nDy, nDz );
+}
+}
+
 const Color& ScColorScaleEntry::GetColor() const
 {
 return maColor;
@@ -390,6 +399,17 @@ void ScColorScaleFormat::UpdateMoveTab(SCTAB nOldTab, 
SCTAB nNewTab)
 }
 }
 
+void ScColorScaleFormat::UpdateReference( UpdateRefMode eUpdateRefMode,
+const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
+{
+maRanges.UpdateReference( eUpdateRefMode, mpDoc, rRange, nDx, nDy, nDz );
+
+for(iterator itr = begin(); itr != end(); ++itr)
+{
+itr->UpdateReference(eUpdateRefMode, rRange, nDx, nDy, nDz);
+}
+}
+
 bool ScColorScaleFormat::CheckEntriesForRel(const ScRange& rRange) const
 {
 bool bNeedUpdate = false;
@@ -500,4 +520,13 @@ void ScColorScaleFormatList::UpdateMoveTab(SCTAB nOldTab, 
SCTAB nNewTab)
 }
 }
 
+void ScColorScaleFormatList::UpdateReference( UpdateRefMode eUpdateRefMode,
+const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
+{
+for(iterator itr = begin(); itr != end(); ++itr)
+{
+itr->UpdateReference( eUpdateRefMode, rRange, nDx, nDy, nDz );
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 605f9cd..1120f05 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -866,6 +866,8 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, 
const ScMarkData* pOnlyM
 //  update conditional formats after table is inserted
 if ( pCondFormList )
 pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,1 
);
+if ( mpColorScaleList )
+mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 
0,0,1 );
 if ( pValidationList )
 pValidationList->UpdateReference( URM_INSDEL, aRange, 
0,0,1 );
 // sheet names of references may not be valid until sheet is 
copied
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index f016df5..f1bce7b 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -79,6 +79,7 @@
 #include "formulaparserpool.hxx"
 #include "clipparam.hxx"
 #include "sheetevents.hxx"
+#include "colorscale.hxx"
 #include "queryentry.hxx"
 
 #include "globalnames.hxx"
@@ -1006,6 +1007,8 @@ void ScDocument::UpdateReference( UpdateRefMode 
eUpdateRefMode,
 pDPCollection->UpdateReference( eUpdateRefMode, aRange, nDx, 
nDy, nDz );
 UpdateChartRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, 
nTab2, nDx, nDy, nDz );
 UpdateRefAreaLinks( eUpdateRefMode, aRange, nDx, nDy, nDz );
+if ( mpColorScaleList )
+mpColorScaleList->UpdateReference( eUpdateRefMode, aRange, 
nDx, nDy, nDz );
 if ( pCondFormList )
 pCondFormList->UpdateReference( eUpdateRefMode, aRange, nDx, 
nDy, nDz );
 if ( pValidationList )
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 52a8d7d..d24cb7f 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -75,6 +75,7 @@
 #include "markdata.hxx"
 #include "drwlayer.hxx"
 #include "conditio.hxx"
+#include "colorsca

[Libreoffice-commits] .: sc/inc sc/source

2012-05-10 Thread Markus Mohrhard
 sc/inc/colorscale.hxx |1 +
 sc/source/core/data/colorscale.cxx|   22 ++
 sc/source/filter/oox/condformatbuffer.cxx |2 --
 3 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 7e934dcf1b8a9147ce703658aea655403716e5df
Author: Markus Mohrhard 
Date:   Fri May 11 07:39:26 2012 +0200

we need to update the formulas now too

Change-Id: I558e1d53339fc4284e8272342846f7bc108df111

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 8a5b203..2d5839f 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -55,6 +55,7 @@ public:
 const Color& GetColor() const;
 double GetValue() const;
 void SetFormula(const rtl::OUString& rFormula, ScDocument* pDoc, const 
ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar = 
formula::FormulaGrammar::GRAM_DEFAULT);
+void UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab, SCTAB nTabNo);
 
 bool GetMin() const;
 bool GetMax() const;
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 33aff61..728d23e 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -74,6 +74,14 @@ double ScColorScaleEntry::GetValue() const
 return mnVal;
 }
 
+void ScColorScaleEntry::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab, SCTAB 
nTabNo )
+{
+if(mpCell)
+{
+mpCell->UpdateMoveTab( nOldTab, nNewTab, nTabNo );
+}
+}
+
 const Color& ScColorScaleEntry::GetColor() const
 {
 return maColor;
@@ -341,17 +349,22 @@ void ScColorScaleFormat::UpdateMoveTab(SCTAB nOldTab, 
SCTAB nNewTab)
 size_t n = maRanges.size();
 SCTAB nMinTab = std::min(nOldTab, nNewTab);
 SCTAB nMaxTab = std::max(nOldTab, nNewTab);
+SCTAB nThisTab = -1;
 for(size_t i = 0; i < n; ++i)
 {
 ScRange* pRange = maRanges[i];
 SCTAB nTab = pRange->aStart.Tab();
 if(nTab < nMinTab || nTab > nMaxTab)
+{
+nThisTab = nTab;
 continue;
+}
 
 if(nTab == nOldTab)
 {
 pRange->aStart.SetTab(nNewTab);
 pRange->aEnd.SetTab(nNewTab);
+nThisTab = nNewTab;
 continue;
 }
 
@@ -359,13 +372,22 @@ void ScColorScaleFormat::UpdateMoveTab(SCTAB nOldTab, 
SCTAB nNewTab)
 {
 pRange->aStart.IncTab();
 pRange->aEnd.IncTab();
+nThisTab = nTab + 1;
 }
 else
 {
 pRange->aStart.IncTab(-1);
 pRange->aEnd.IncTab(-1);
+nThisTab = nTab - 1;
 }
 }
+
+if(nThisTab == -1)
+nThisTab = 0;
+for(iterator itr = begin(); itr != end(); ++itr)
+{
+itr->UpdateMoveTab(nOldTab, nNewTab, nThisTab);
+}
 }
 
 bool ScColorScaleFormat::CheckEntriesForRel(const ScRange& rRange) const
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index d14ce8a..0c9cc37 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -227,8 +227,6 @@ void ColorScaleRule::importColor( const AttributeList& 
rAttribs )
 
 void ColorScaleRule::AddEntries( ScColorScaleFormat* pFormat, ScDocument* 
pDoc, const ScAddress& rAddr )
 {
-//assume that both vectors contain the same entries
-// TODO: check it
 for(size_t i = 0; i < maColorScaleRuleEntries.size(); ++i)
 {
 ScColorScaleEntry* pEntry = new 
ScColorScaleEntry(maColorScaleRuleEntries[i].mnVal, 
maColorScaleRuleEntries[i].maColor);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-05-09 Thread Markus Mohrhard
 sc/inc/colorscale.hxx |2 
 sc/inc/fillinfo.hxx   |   11 +++
 sc/source/core/data/colorscale.cxx|   10 ++-
 sc/source/core/data/fillinfo.cxx  |2 
 sc/source/filter/oox/condformatbuffer.cxx |5 -
 sc/source/ui/view/output.cxx  |   85 +++---
 6 files changed, 87 insertions(+), 28 deletions(-)

New commits:
commit b1ba05b2cc7bdbb21fb2a9626b029f0c46926ac4
Author: Markus Mohrhard 
Date:   Thu May 10 02:14:16 2012 +0200

Color Scales are now displayed after import from xlsx

It is still displayed at the wrong position but it looks promising.

Change-Id: I7ee55525cc219594635d81240f198b0a30c8707d

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index df65333..01ff306 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -55,6 +55,8 @@ private:
 typedef boost::ptr_vector ColorScaleEntries;
 ColorScaleEntries maColorScales;
 public:
+ScColorScaleFormat(ScDocument* pDoc);
+
 Color* GetColor(const ScAddress& rAddr) const;
 void AddEntry(ScColorScaleEntry* pEntry);
 
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index 167e24a..a5786ba 100644
--- a/sc/inc/fillinfo.hxx
+++ b/sc/inc/fillinfo.hxx
@@ -31,7 +31,6 @@
 
 #include 
 #include "global.hxx"
-#include 
 
 class SfxItemSet;
 class SvxBrushItem;
@@ -69,7 +68,7 @@ struct CellInfo
 
 const ScPatternAttr*pPatternAttr;
 const SfxItemSet*   pConditionSet;
-boost::shared_ptrpColorScale;
+const Color*pColorScale;
 
 const SvxBrushItem* pBackground;
 
@@ -103,6 +102,14 @@ struct CellInfo
 
 sal_BoolbHideGrid : 1;  // 
output-internal
 sal_BoolbEditEngine : 1;// 
output-internal
+
+CellInfo():
+pColorScale(NULL) {}
+
+~CellInfo()
+{
+delete pColorScale;
+}
 };
 
 const SCCOL SC_ROTMAX_NONE = SCCOL_MAX;
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 787690d..f05afb0 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -54,6 +54,11 @@ const Color& ScColorScaleEntry::GetColor() const
 return maColor;
 }
 
+ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc):
+mpDoc(pDoc)
+{
+}
+
 void ScColorScaleFormat::AddEntry( ScColorScaleEntry* pEntry )
 {
 maColorScales.push_back( pEntry );
@@ -99,7 +104,7 @@ Color* ScColorScaleFormat::GetColor( const ScAddress& rAddr 
) const
 // now we have for sure a value
 double nVal = mpDoc->GetValue(rAddr);
 
-if (!maColorScales.size() < 2)
+if (maColorScales.size() < 2)
 return NULL;
 
 const_iterator itr = begin();
@@ -109,13 +114,14 @@ Color* ScColorScaleFormat::GetColor( const ScAddress& 
rAddr ) const
 double nValMax = itr->GetValue();
 Color rColMax = itr->GetColor();
 
+++itr;
 while(itr != end() && nVal > nValMin)
 {
-++itr;
 rColMin = rColMax;
 nValMin = nValMax;
 rColMax = itr->GetColor();
 nValMax = itr->GetValue();
+++itr;
 }
 
 Color aColor = CalcColor(nVal, nValMin, rColMin, nValMax, rColMax);
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 8ad3dba..9d7fc2f 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -568,7 +568,7 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL 
nX1, SCROW nY1, SCCOL nX
 if ( pColorScale )
 {
 Color* pColor = pColorScale->GetColor( 
ScAddress( nX, nCurRow, nTab ) );
-pInfo->pColorScale.reset(pColor);
+pInfo->pColorScale = pColor;
 }
 
 ++nArrY;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index e189c75..8cc7778 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -61,8 +61,6 @@
 #include "docpool.hxx"
 #include "scitems.hxx"
 
-#include 
-
 namespace oox {
 namespace xls {
 
@@ -158,7 +156,6 @@ void ColorScaleRule::importValue( const AttributeList& 
rAttribs )
 {
 double nVal = rAttribs.getDouble( XML_val, 0.0 );
 maValues.push_back(nVal);
-std::cout << "ColorScaleRule::importValue: " << nVal << std::endl;
 }
 }
 
@@ -659,7 +656,7 @@ void CondFormatRule::finalizeImport( const Reference< 
XSheetConditionalEntries >
 else if( mpColor )
 {
 ScDocument& rDoc = getScDocument();
-ScColorScaleFormat* pFormat = new ScColorScaleFormat();
+ScColorScaleFormat* pFormat = new ScColorScaleFormat(&rDoc);
 
 mpColor->AddEntries( pFormat );
 sal_Int32 nIndex = rDoc.AddColorScaleForm

[Libreoffice-commits] .: sc/inc sc/source

2012-04-26 Thread Kohei Yoshida
 sc/inc/fielduno.hxx  |7 +--
 sc/source/ui/unoobj/cellsuno.cxx |5 -
 sc/source/ui/unoobj/fielduno.cxx |   10 +-
 3 files changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 502e11b22eef0b2cfc544790e9430406dda8321e
Author: Kohei Yoshida 
Date:   Thu Apr 26 15:32:52 2012 -0400

Pass ScCellObj instance to ScCellFieldsObj instead of creating a new one.

diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index 7c237b2..4f3d29b 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -69,6 +69,7 @@ class ScCellFieldsObj : public cppu::WeakImplHelper5<
 public SfxListener
 {
 private:
+com::sun::star::uno::Reference mxContent;
 ScDocShell* pDocShell;
 ScAddress   aCellPos;
 ScEditSource* mpEditSource;
@@ -82,8 +83,10 @@ private:
 GetObjectByIndex_Impl(sal_Int32 Index) const;
 
 public:
-ScCellFieldsObj(ScDocShell* pDocSh, const 
ScAddress& rPos);
-virtual ~ScCellFieldsObj();
+ScCellFieldsObj(
+const 
com::sun::star::uno::Reference& xContent,
+ScDocShell* pDocSh, const ScAddress& rPos);
+virtual ~ScCellFieldsObj();
 
 virtual voidNotify( SfxBroadcaster& rBC, const SfxHint& rHint 
);
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index a916c6d..9f874e3 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6704,7 +6704,10 @@ uno::Reference SAL_CALL 
ScCellObj::getTextFields(
 SolarMutexGuard aGuard;
 ScDocShell* pDocSh = GetDocShell();
 if ( pDocSh )
-return new ScCellFieldsObj( pDocSh, aCellPos );
+{
+uno::Reference xContent(this);
+return new ScCellFieldsObj(xContent, pDocSh, aCellPos);
+}
 
 return NULL;
 }
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index fcc5f3b..2753fa6 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -295,7 +295,10 @@ SvxFieldData* ScUnoEditEngine::FindByPos(sal_uInt16 nPar, 
xub_StrLen nPos, TypeI
 
 //
 
-ScCellFieldsObj::ScCellFieldsObj(ScDocShell* pDocSh, const ScAddress& rPos) :
+ScCellFieldsObj::ScCellFieldsObj(
+const uno::Reference& xContent,
+ScDocShell* pDocSh, const ScAddress& rPos) :
+mxContent(xContent),
 pDocShell( pDocSh ),
 aCellPos( rPos ),
 mpRefreshListeners( NULL )
@@ -353,16 +356,13 @@ uno::Reference 
ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3
 if (!pData)
 return uno::Reference();
 
-// Get the parent text range instance.
-uno::Reference xContent(new ScCellObj(pDocShell, 
aCellPos));
-
 sal_uInt16 nPar = aTempEngine.GetFieldPar();
 xub_StrLen nPos = aTempEngine.GetFieldPos();
 ESelection aSelection( nPar, nPos, nPar, nPos+1 );  // Feld ist 1 
Zeichen
 
 ScEditFieldObj::FieldType eType = getFieldType(pData->GetClassId());
 uno::Reference xRet(
-new ScEditFieldObj(xContent, new ScCellEditSource(pDocShell, 
aCellPos), eType, aSelection));
+new ScEditFieldObj(mxContent, new ScCellEditSource(pDocShell, 
aCellPos), eType, aSelection));
 return xRet;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-04-26 Thread Kohei Yoshida
 sc/inc/cellsuno.hxx  |3 ++-
 sc/source/ui/unoobj/cellsuno.cxx |   32 ++--
 2 files changed, 16 insertions(+), 19 deletions(-)

New commits:
commit 109e2a783d029de8828cb980fd55441749e4a3f7
Author: Kohei Yoshida 
Date:   Thu Apr 26 14:41:07 2012 -0400

Ditto.  Use rtl::Reference.

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index c631569..9bf0b3b 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -33,6 +33,7 @@
 #include "rangelst.hxx" // ScRangeList
 
 #include "formula/grammar.hxx"
+#include "rtl/ref.hxx"
 #include 
 #include 
 #include 
@@ -833,7 +834,7 @@ class SC_DLLPUBLIC ScCellObj : public ScCellRangeObj,
 public com::sun::star::document::XActionLockable
 {
 private:
-SvxUnoText* pUnoText;
+rtl::Reference mxUnoText;
 const SfxItemPropertySet*   pCellPropSet;
 ScAddress   aCellPos;
 sal_Int16   nActionLockCount;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index dde5a44..a916c6d 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6107,7 +6107,6 @@ const SfxItemPropertyMap& ScCellObj::GetCellPropertyMap()
 
 ScCellObj::ScCellObj(ScDocShell* pDocSh, const ScAddress& rP) :
 ScCellRangeObj( pDocSh, ScRange(rP,rP) ),
-pUnoText( NULL ),
 pCellPropSet( lcl_GetCellPropertySet() ),
 aCellPos( rP ),
 nActionLockCount( 0 )
@@ -6118,25 +6117,22 @@ ScCellObj::ScCellObj(ScDocShell* pDocSh, const 
ScAddress& rP) :
 
 SvxUnoText& ScCellObj::GetUnoText()
 {
-if (!pUnoText)
+if (!mxUnoText.is())
 {
-pUnoText = new ScCellTextObj( GetDocShell(), aCellPos );
-pUnoText->acquire();
+mxUnoText.set(new ScCellTextObj(GetDocShell(), aCellPos));
 if (nActionLockCount)
 {
 ScCellEditSource* pEditSource =
-static_cast (pUnoText->GetEditSource());
+static_cast (mxUnoText->GetEditSource());
 if (pEditSource)
 pEditSource->SetDoUpdateData(false);
 }
 }
-return *pUnoText;
+return *mxUnoText;
 }
 
 ScCellObj::~ScCellObj()
 {
-if (pUnoText)
-pUnoText->release();
 }
 
 void ScCellObj::RefChanged()
@@ -6390,8 +6386,8 @@ void SAL_CALL ScCellObj::setString( const rtl::OUString& 
aText ) throw(uno::Runt
 SetString_Impl(aString, false, false);  // immer Text
 
 // don't create pUnoText here if not there
-if (pUnoText)
-pUnoText->SetSelection(ESelection( 0,0, 0,aString.Len() ));
+if (mxUnoText.is())
+mxUnoText->SetSelection(ESelection( 0,0, 0,aString.Len() ));
 }
 
 void SAL_CALL ScCellObj::insertString( const uno::Reference& 
xRange,
@@ -6831,10 +6827,10 @@ void SAL_CALL ScCellObj::addActionLock() 
throw(uno::RuntimeException)
 SolarMutexGuard aGuard;
 if (!nActionLockCount)
 {
-if (pUnoText)
+if (mxUnoText.is())
 {
 ScCellEditSource* pEditSource =
-static_cast (pUnoText->GetEditSource());
+static_cast (mxUnoText->GetEditSource());
 if (pEditSource)
 pEditSource->SetDoUpdateData(false);
 }
@@ -6850,10 +6846,10 @@ void SAL_CALL ScCellObj::removeActionLock() 
throw(uno::RuntimeException)
 nActionLockCount--;
 if (!nActionLockCount)
 {
-if (pUnoText)
+if (mxUnoText.is())
 {
 ScCellEditSource* pEditSource =
-static_cast (pUnoText->GetEditSource());
+static_cast 
(mxUnoText->GetEditSource());
 if (pEditSource)
 {
 pEditSource->SetDoUpdateData(sal_True);
@@ -6868,10 +6864,10 @@ void SAL_CALL ScCellObj::removeActionLock() 
throw(uno::RuntimeException)
 void SAL_CALL ScCellObj::setActionLocks( sal_Int16 nLock ) 
throw(uno::RuntimeException)
 {
 SolarMutexGuard aGuard;
-if (pUnoText)
+if (mxUnoText.is())
 {
 ScCellEditSource* pEditSource =
-static_cast (pUnoText->GetEditSource());
+static_cast (mxUnoText->GetEditSource());
 if (pEditSource)
 {
 pEditSource->SetDoUpdateData(nLock == 0);
@@ -6886,10 +6882,10 @@ sal_Int16 SAL_CALL ScCellObj::resetActionLocks() 
throw(uno::RuntimeException)
 {
 SolarMutexGuard aGuard;
 sal_uInt16 nRet(nActionLockCount);
-if (pUnoText)
+if (mxUnoText.is())
 {
 ScCellEditSource* pEditSource =
-static_cast (pUnoText->GetEditSource());
+static_cast (mxUnoText->GetEditSource());
 if (pEditSource)
 {
 pEditSource->SetDoUpdateData(sal_True);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/inc sc/source

2012-04-26 Thread Kohei Yoshida
 sc/inc/textuno.hxx  |2 -
 sc/source/ui/unoobj/textuno.cxx |   66 ++--
 2 files changed, 31 insertions(+), 37 deletions(-)

New commits:
commit 69da3e140d58a524ab43c8fbbadbd8b8bf9de262
Author: Kohei Yoshida 
Date:   Thu Apr 26 14:32:46 2012 -0400

Let's use rtl::Reference instead of a raw pointer and manual refcount 
adjust..

diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index db2d660..fd110c3 100644
--- a/sc/inc/textuno.hxx
+++ b/sc/inc/textuno.hxx
@@ -161,7 +161,7 @@ class ScHeaderFooterTextObj : public cppu::WeakImplHelper5<
 {
 private:
 ScHeaderFooterTextData  aTextData;
-SvxUnoText* pUnoText;
+rtl::Reference mxUnoText;
 
 voidCreateUnoText_Impl();
 
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 87f241e..fbae7fd 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -284,8 +284,7 @@ const EditTextObject* 
ScHeaderFooterTextData::GetTextObject() const
 
 ScHeaderFooterTextObj::ScHeaderFooterTextObj(
 ScHeaderFooterContentObj& rContent, sal_uInt16 nP, const EditTextObject* 
pTextObj) :
-aTextData(rContent, nP, pTextObj),
-pUnoText( NULL )
+aTextData(rContent, nP, pTextObj)
 {
 //  ScHeaderFooterTextData acquires rContent
 //  pUnoText is created on demand (getString/setString work without it)
@@ -293,20 +292,15 @@ ScHeaderFooterTextObj::ScHeaderFooterTextObj(
 
 void ScHeaderFooterTextObj::CreateUnoText_Impl()
 {
-if ( !pUnoText )
+if (!mxUnoText.is())
 {
 //  can't be aggregated because getString/setString is handled here
 ScHeaderFooterEditSource aEditSrc(aTextData);
-pUnoText = new SvxUnoText(&aEditSrc, lcl_GetHdFtPropertySet(), 
uno::Reference());
-pUnoText->acquire();
+mxUnoText.set(new SvxUnoText(&aEditSrc, lcl_GetHdFtPropertySet(), 
uno::Reference()));
 }
 }
 
-ScHeaderFooterTextObj::~ScHeaderFooterTextObj()
-{
-if (pUnoText)
-pUnoText->release();
-}
+ScHeaderFooterTextObj::~ScHeaderFooterTextObj() {}
 
 const EditTextObject* ScHeaderFooterTextObj::GetTextObject() const
 {
@@ -315,9 +309,9 @@ const EditTextObject* 
ScHeaderFooterTextObj::GetTextObject() const
 
 const SvxUnoText& ScHeaderFooterTextObj::GetUnoText()
 {
-if (!pUnoText)
+if (!mxUnoText.is())
 CreateUnoText_Impl();
-return *pUnoText;
+return *mxUnoText;
 }
 
 // XText
@@ -334,9 +328,9 @@ uno::Reference SAL_CALL 
ScHeaderFooterTextObj::createTextCurs
 
throw(uno::RuntimeException)
 {
 SolarMutexGuard aGuard;
-if (!pUnoText)
+if (!mxUnoText.is())
 CreateUnoText_Impl();
-return pUnoText->createTextCursorByRange(aTextPosition);
+return mxUnoText->createTextCursorByRange(aTextPosition);
 //! wie ScCellObj::createTextCursorByRange, wenn 
SvxUnoTextRange_getReflection verfuegbar
 }
 
@@ -397,9 +391,9 @@ void SAL_CALL ScHeaderFooterTextObj::insertString( const 
uno::ReferenceinsertString( xRange, aString, bAbsorb );
+mxUnoText->insertString( xRange, aString, bAbsorb );
 }
 
 void SAL_CALL ScHeaderFooterTextObj::insertControlCharacter(
@@ -408,9 +402,9 @@ void SAL_CALL ScHeaderFooterTextObj::insertControlCharacter(
 throw(lang::IllegalArgumentException, 
uno::RuntimeException)
 {
 SolarMutexGuard aGuard;
-if (!pUnoText)
+if (!mxUnoText.is())
 CreateUnoText_Impl();
-pUnoText->insertControlCharacter( xRange, nControlCharacter, bAbsorb );
+mxUnoText->insertControlCharacter( xRange, nControlCharacter, bAbsorb );
 }
 
 void SAL_CALL ScHeaderFooterTextObj::insertTextContent(
@@ -490,9 +484,9 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent(
 }
 }
 
-if (!pUnoText)
+if (!mxUnoText.is())
 CreateUnoText_Impl();
-pUnoText->insertTextContent( xRange, xContent, bAbsorb );
+mxUnoText->insertTextContent( xRange, xContent, bAbsorb );
 }
 
 void SAL_CALL ScHeaderFooterTextObj::removeTextContent(
@@ -510,33 +504,33 @@ void SAL_CALL ScHeaderFooterTextObj::removeTextContent(
 return;
 }
 }
-if (!pUnoText)
+if (!mxUnoText.is())
 CreateUnoText_Impl();
-pUnoText->removeTextContent( xContent );
+mxUnoText->removeTextContent( xContent );
 }
 
 uno::Reference SAL_CALL ScHeaderFooterTextObj::getText() 
throw(uno::RuntimeException)
 {
 SolarMutexGuard aGuard;
-if (!pUnoText)
+if (!mxUnoText.is())
 CreateUnoText_Impl();
-return pUnoText->getText();
+return mxUnoText->getText();
 }
 
 uno::Reference SAL_CALL ScHeaderFooterTextObj::getStart() 
throw(uno::RuntimeException)
 {
 SolarMutexGuard aGuard;
-if (!pUnoText)
+if (!mxUnoText.is())
 CreateUnoText_Impl();
-return pUnoText->getStart();
+return mxUnoText->getStart();
 }
 
 uno::Reference SAL_CALL ScHeaderFooterTextObj::getEnd() 

[Libreoffice-commits] .: sc/inc sc/source unusedcode.easy

2012-04-26 Thread Jesús Corrius
 sc/inc/dpobject.hxx  |1 -
 sc/source/core/data/dpobject.cxx |   12 
 unusedcode.easy  |1 -
 3 files changed, 14 deletions(-)

New commits:
commit 81647009acd50ba057ccdae8e8fe09f8a4335e28
Author: Javier Catala 
Date:   Thu Apr 26 11:23:47 2012 +0200

Remove unused method ScDPObject::HasGroups

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 4f97b40..64525fd 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -138,7 +138,6 @@ public:
 voidInvalidateData();
 void ClearTableData();
 void ReloadGroupTableData();
-bool HasGroups() const;
 
 voidOutput( const ScAddress& rPos );
 ScRange GetNewOutputRange( bool& rOverflow );
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 2a431da..a3ae9ab 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -585,18 +585,6 @@ void ScDPObject::ReloadGroupTableData()
 bSettingsChanged = true;
 }
 
-bool ScDPObject::HasGroups() const
-{
-if (!pSaveData)
-return false;
-
-const ScDPDimensionSaveData* pDimData = 
pSaveData->GetExistingDimensionData();
-if (!pDimData)
-return false;
-
-return pDimData->HasGroupDimensions();
-}
-
 void ScDPObject::ClearSource()
 {
 Reference< XComponent > xObjectComp( xSource, UNO_QUERY );
diff --git a/unusedcode.easy b/unusedcode.easy
index f2ca669..3bc7388 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -51,7 +51,6 @@ ScCsvControl::ScCsvControl(Window*, ScCsvLayoutData const&, 
long)
 
ScDBCollection::AnonDBs::erase(boost::void_ptr_iterator<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator > >, 
std::__debug::vector > >, ScDBData>)
 ScDBCollection::AnonDBs::findByTable(short) const
 ScDPLabelData::ScDPLabelData(rtl::OUString const&, short, bool)
-ScDPObject::HasGroups() const
 ScHTMLColOffset::Insert(ScHTMLColOffset const*, unsigned short, unsigned short)
 ScHTMLColOffset::Insert(unsigned long const&, unsigned short&)
 ScHTMLColOffset::Insert(unsigned long const*, unsigned short)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: [Libreoffice] [Libreoffice-commits] .: sc/inc sc/source

2011-11-15 Thread Stephan Bergmann

On 11/16/2011 06:45 AM, Kohei Yoshida wrote:

I would encourage you to not do this style of implicit inlining in your
code, sure, but I wouldn't want you go wild and start editing a bunch of
headers just for the sake of it.


While we are at it:  Not inlining functions can be especially beneficial 
for functions that are exported from a library.  For example, not 
inlining the destructor of a class with virtual functions gives the 
compiler a definite place to put the vtable, so it need not be 
duplicated across all the libraries that derive from that class.


Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [Libreoffice-commits] .: sc/inc sc/source

2011-11-15 Thread Kohei Yoshida
On Wed, 2011-11-16 at 00:36 -0500, Kevin Hunter wrote:

> Thanks for the info.  Would you like me to do similar, as I note them 
> while working on/learning notes?

I would encourage you to not do this style of implicit inlining in your
code, sure, but I wouldn't want you go wild and start editing a bunch of
headers just for the sake of it.

This is not a definite rule; use your best judgment is what I would say.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [Libreoffice-commits] .: sc/inc sc/source

2011-11-15 Thread Kevin Hunter

At 12:28am -0500 Wed, 16 Nov 2011, Kohei Yoshida wrote:

On Wed, Nov 16, 2011 at 12:21 AM, Kevin Hunter wrote:

 From the curious cat: why?


Because that made it easier to debug whatever I was debugging.  Plus,
I don't believe in those implicitly inline methods, especially in
headers that are included by millions.  Imagine if you have to
re-compile hundreds of source files every time you change the
header...


Heh, been there, done that.  /Doing/ that as I type.  And still 
compiling that ...


Thanks for the info.  Would you like me to do similar, as I note them 
while working on/learning notes?


Kevin

P.S. Still compiling, because of a header change.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [Libreoffice-commits] .: sc/inc sc/source

2011-11-15 Thread Kohei Yoshida
Hi Kevin,

On Wed, Nov 16, 2011 at 12:21 AM, Kevin Hunter  wrote:

> From the curious cat: why?

Because that made it easier to debug whatever I was debugging.  Plus,
I don't believe in those implicitly inline methods, especially in
headers that are included by millions.  Imagine if you have to
re-compile hundreds of source files every time you change the
header...

Kohei
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [Libreoffice-commits] .: sc/inc sc/source

2011-11-15 Thread Kevin Hunter

At 3:21pm -0500 Tue, 15 Nov 2011, Kohei Yoshida wrote:

  sc/inc/cell.hxx   |4 ++--
  sc/source/core/data/cell2.cxx |   10 ++
  2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 87be97a31d8686e3e6e976bb5585b32c096ca19d
Author: Kohei Yoshida
Date:   Tue Nov 15 15:20:13 2011 -0500

 Make these two methods non-inline.


From the curious cat: why?  As I slowly code, are there coding 
guidelines of which I should be aware but have missed?  Are you working 
toward keeping signatures in one place and definitions/instantiations in 
another?


Thanks,

Kevin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [Libreoffice-commits] .: sc/inc sc/source

2011-11-14 Thread Kohei Yoshida
Hi Eike,

On Mon, 2011-11-14 at 15:04 +0100, Eike Rathke wrote:

> IMHO (correct me if I'm wrong) for the sorted range lookup Excel returns
> #N/A if the search is of type Text and the last element found for
> less_or_equal is of type Number. 

Yup, you're right!  Tested with Excel 2007, and Excel returns #N/A even
when the last match found is of type Number.

> This is also what ODFF/OpenFormula
> defines, for example for VLOOKUP
> http://docs.oasis-open.org/office/v1.2/cs01/OpenDocument-v1.2-cs01-part2.html#__RefHeading__1018436_715980110

Ok.  I missed this sentence:

"If Lookup is of type Text and the value found is of type Number, the
#N/A Error is returned."

which supports the behavior before my revert (and current Excel's).

I was focusing this sentence:

"If the types are mixed, Numbers are sorted before Text, and Text before
Logicals..."

and interpreted it to mean that, if the lookup value is text, and the
match is not found within the text range, return the last matched value
from the number range.  But I guess my interpretation was not
correct. :-/

> My question was more in the direction if, when the mixed lookup is
> removed, we return the correct results for those spreadsheet functions
> accordind to ODFF. If yes, then the removal is fine.

The answer is yes, fortunately.  I'll revert my revert shortly.  Thanks
a lot for the follow-up explanation.  This makes things a lot easier for
me. :-)

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [Libreoffice-commits] .: sc/inc sc/source

2011-11-14 Thread Eike Rathke
Hi Kohei,

On Friday, 2011-11-11 12:17:21 -0500, Kohei Yoshida wrote:

> > > commit eaea417bfdf8d06df2b7f2e42c904c32ce77e871
> > > Removing the mixed comparison flag, which is no longer needed.
> > 
> > Isn't that needed for MATCH and ([HV])LOOKUP with mixed data such as
> > 1,2,3,b,c,d when queried for "a" would return the last less_or_equal
> > position, hence 3? Or are we now on a good track where when querying for
> > string we always return #N/A if the less_or_equal match is numeric (and
> > vice versa)?
> 
> Thanks.  Reverted.  Will try to come up with a different approach then.

IMHO (correct me if I'm wrong) for the sorted range lookup Excel returns
#N/A if the search is of type Text and the last element found for
less_or_equal is of type Number. This is also what ODFF/OpenFormula
defines, for example for VLOOKUP
http://docs.oasis-open.org/office/v1.2/cs01/OpenDocument-v1.2-cs01-part2.html#__RefHeading__1018436_715980110

My question was more in the direction if, when the mixed lookup is
removed, we return the correct results for those spreadsheet functions
accordind to ODFF. If yes, then the removal is fine.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD


pgp6aPkD6ppJF.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [Libreoffice-commits] .: sc/inc sc/source

2011-11-11 Thread Kohei Yoshida
On Fri, 2011-11-11 at 15:41 +0100, Eike Rathke wrote:
> Hi Kohei,
> 
> On Thursday, 2011-11-10 12:49:29 -0800, Kohei Yoshida wrote:
> 
> > commit eaea417bfdf8d06df2b7f2e42c904c32ce77e871
> > Author: Kohei Yoshida 
> > Date:   Thu Nov 10 15:45:53 2011 -0500
> > 
> > Removing the mixed comparison flag, which is no longer needed.
> > 
> > This flag was introduced years ago to deal with Excel's behavior on
> > incorrectly sorted data range. But later versions of Excel no longer
> > follow that behavior & keeping this flag would make the evaluation
> > code unnecessarily more complex & hard to adopt to multi-item matching.
> 
> Isn't that needed for MATCH and ([HV])LOOKUP with mixed data such as
> 1,2,3,b,c,d when queried for "a" would return the last less_or_equal
> position, hence 3? Or are we now on a good track where when querying for
> string we always return #N/A if the less_or_equal match is numeric (and
> vice versa)?

Thanks.  Reverted.  Will try to come up with a different approach then.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [Libreoffice-commits] .: sc/inc sc/source

2011-11-11 Thread Eike Rathke
Hi Kohei,

On Thursday, 2011-11-10 12:49:29 -0800, Kohei Yoshida wrote:

> commit eaea417bfdf8d06df2b7f2e42c904c32ce77e871
> Author: Kohei Yoshida 
> Date:   Thu Nov 10 15:45:53 2011 -0500
> 
> Removing the mixed comparison flag, which is no longer needed.
> 
> This flag was introduced years ago to deal with Excel's behavior on
> incorrectly sorted data range. But later versions of Excel no longer
> follow that behavior & keeping this flag would make the evaluation
> code unnecessarily more complex & hard to adopt to multi-item matching.

Isn't that needed for MATCH and ([HV])LOOKUP with mixed data such as
1,2,3,b,c,d when queried for "a" would return the last less_or_equal
position, hence 3? Or are we now on a good track where when querying for
string we always return #N/A if the less_or_equal match is numeric (and
vice versa)?

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD


pgpMLqpstyCPG.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice