[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 kohei.yosh...@gmail.com
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::vectorColEntry::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_castScFormulaCell*(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 

[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 kohei.yosh...@gmail.com
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_functionScDPObject, void
+{
+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_castconst ScMergeFlagAttr*(
-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] .: 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 kohei.yosh...@gmail.com
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 kohei.yosh...@gmail.com
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_castsal_Bool(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::Referencebeans::XPropertySet 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_castbool(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/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 kohei.yosh...@gmail.com
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::vectorsal_uInt16 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_functionsal_uInt16, void
+{
+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::vectorsal_uInt16::iterator itEnd = 
std::unique(maExternalFiles.begin(), maExternalFiles.end());
+std::for_each(maExternalFiles.begin(), itEnd, 
ExternalFileInserter(aPos, 

[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 kohei.yosh...@gmail.com
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 sfx2/objface.hxx
 #include svl/documentlockfile.hxx
 #include svl/sharecontrolfile.hxx
+#include svl/urihelper.hxx
 #include chgtrack.hxx
 #include chgviset.hxx
 #include com/sun/star/awt/Key.hpp
@@ -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-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 noel.po...@suse.com
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

[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 kohei.yosh...@gmail.com
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_castScEditCell*(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_castconst 
ScEditCell*(pCell)-GetData();
 if ( pObj )
 {
 rEngine.SetText( *pObj );
diff --git a/sc/source/filter/xml/xmlcelli.cxx 

[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 markus.mohrh...@googlemail.com
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 xmloff/xmltkmap.hxx
@@ -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 kohei.yosh...@gmail.com
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 

[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 kohei.yosh...@gmail.com
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-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 kohei.yosh...@gmail.com
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_treeSCROW, bool 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_castsize_t(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_castsize_t(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.
 

[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 caol...@redhat.com
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 kohei.yosh...@gmail.com
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 com/sun/star/table/CellAddress.hpp
-#include com/sun/star/sheet/XCalculatable.hpp
 #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_castScDocShell*(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_castScDocShell*(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 sberg...@redhat.com
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_ptrScCondDateFormatCache mpCache;
+mutable boost::scoped_ptrDate 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 noel.po...@suse.com
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 

[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 markus.mohrh...@googlemail.com
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 matus.ku...@gmail.com
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::vectorsal_uInt32 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::vectorsal_uInt32 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 svx/drawitem.hxx
 #include vcl/msgbox.hxx
 
-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()

[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 kohei.yosh...@gmail.com
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 markus.mohrh...@googlemail.com
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::vectordouble rValues ) const;
+std::vectordouble getValues() const;
+
+double getMinValue() const;
+double getMaxValue() const;
 
 ScConditionalFormat* mpParent;
+
+private:
+
+struct ScColorFormatCache
+{
+std::vectordouble maValues;
+};
+mutable boost::scoped_ptrScColorFormatCache 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 iostream
 #endif
 
+#include algorithm
+
 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_limitsdouble::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_castScFormulaCell*(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_limitsdouble::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_castScFormulaCell*(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_limitsdouble::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_limitsdouble::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 

[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 noel.po...@suse.com
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_castScStyleSheet(*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_castScStyleSheet(*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( 

[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 markus.mohrh...@googlemail.com
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 rtl/math.hxx
+
 #include boost/ptr_container/ptr_set.hpp
 #include boost/ptr_container/ptr_vector.hpp
+#include boost/scoped_ptr.hpp
 
 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_functiondouble, double, bool
+{
+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::maprtl::OUString, sal_Int32 StringCacheType;
+StringCacheType maStrings;
+typedef std::mapdouble, sal_Int32, approx_less ValueCacheType;
+ValueCacheType maValues;
+};
+
+mutable boost::scoped_ptrScConditionEntryCache 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);
-}
-
-  

[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 noel.po...@suse.com
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::mapsal_uInt16, sal_uInt16 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_ptrScTokenArray 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 kohei.yosh...@gmail.com
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/05/2012 05:57 PM, Libreoffice Gerrit user wrote:

commit bedbb471c3f49e0860dd63b17c1faeee837096ae
Author: Markus Mohrhard markus.mohrh...@googlemail.com
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


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 sberg...@redhat.com:

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


[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 markus.mohrh...@googlemail.com
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_castconst ScCondFormatEntry(*this) == 
static_castconst ScCondFormatEntry(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; inEntryCount; i++)
-if ( ! (*ppEntries[i] == *r.ppEntries[i]) )
+for (sal_uInt16 i=0; isize(); i++)
+if ( ! (maEntries == r.maEntries ) )
 return false;
-*/
 
-return maRanges == r.maRanges;
+// right now don't check for same range
+// we only use this method to merge same conditional formats from
+// old ODF data structure
+return true;
 }
 
 void ScConditionalFormat::AddRange( const ScRangeList rRanges )
diff --git a/sc/source/filter/xml/xmlimprt.cxx 
b/sc/source/filter/xml/xmlimprt.cxx
index 495e7d7..0de87a2 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -2684,11 +2684,13 @@ void ScXMLImport::SetStyleToRanges()
 if (pStyle)
 {
 pStyle-FillPropertySet(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::Sequencetable::CellRangeAddress 
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
 

[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 kohei.yosh...@gmail.com
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::Sequencertl::OUString 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, SequenceOUString 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 daniel.e.banks...@gmail.com
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 

[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 kohei.yosh...@gmail.com
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 vector
 #include set
 
-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 unotools/localedatawrapper.hxx
 #include svl/zforlist.hxx
 
-#include com/sun/star/sdbc/DataType.hpp
-#include com/sun/star/sdbc/XResultSetMetaData.hpp
-#include com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp
-#include com/sun/star/sdbc/XRow.hpp
-#include com/sun/star/sdbc/XRowSet.hpp
-
 #include memory
 
-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 Referencesdbc::XRow 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 ) 
/ 

[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 matus.ku...@gmail.com
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 ScCompressedArrayIteratorA,D;
-
 size_t  nCount;
 size_t  nLimit;
 size_t  nDelta;
@@ -165,184 +158,6 @@ const D ScCompressedArrayA,D::GetNextValue( size_t 
nIndex, A nEnd ) const
 return pData[nEntry].aValue;
 }
 
-
-template typename A, typename D 
-size_t ScCompressedArrayA,D::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
-methodResync()/method with the row where resynchronization should
-start. After doing so, methodGetRangeStart()/method and
-methodGetRangeEnd()/method may not point to the previous access points
-anymore. Use with care.
- */
-
-template typename A, typename D  class ScCompressedArrayIterator
-{
-public:
-ScCompressedArrayIterator(
-const ScCompressedArrayA,D  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 Doperator *() 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 ScCompressedArrayIteratorA,X 
);
-
-private:
-const ScCompressedArrayA,D   rArray;
-size_t  nIndex;
-A   nIterStart;
-A   nIterEnd;
-A   nCurrent;
-boolbEnd;
-};
-
-
-template typename A, typename D 
-ScCompressedArrayIteratorA,D::ScCompressedArrayIterator(
-const ScCompressedArrayA,D  rArrayP, A nStart, A nEnd )
-: rArray( rArrayP )
-// other values set in NewLimits()
-{
-NewLimits( nStart, nEnd);
-}
-
-
-template typename A, typename D 
-void ScCompressedArrayIteratorA,D::NewLimits( A nStart, A nEnd )
-{
-nIterStart = nStart;
-nIterEnd = nEnd;
-nIndex = rArray.Search( nStart);
-nCurrent = GetRangeStart();
-bEnd = (nIterEnd  nIterStart);
-}
-
-
-template typename A, typename D 
-A ScCompressedArrayIteratorA,D::GetIterStart() const
-{
-return nIterStart;
-}
-
-
-template typename A, typename D 
-A ScCompressedArrayIteratorA,D::GetIterEnd() const
-{
-return nIterEnd;
-}
-
-
-template typename A, typename D 
-bool ScCompressedArrayIteratorA,D::operator++()
-{
-if (nCurrent  GetRangeEnd())
-{
-++nCurrent;
-return true;
-}
-else
-return NextRange();
-}
-
-
-template typename A, typename D 
-A 

[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 serval2...@yahoo.fr
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_castSCTAB (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_castSCTAB (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_castSCTAB(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 @@ ScCompressedArrayint, unsigned short::Remove(int, unsigned 
long)
 ScCompressedArrayint, unsigned short::ScCompressedArray(int, unsigned short 
const, unsigned long)
 ScCompressedArrayint, unsigned short::ScCompressedArray(int, unsigned short 
const*, unsigned long)
 ScCompressedArrayint, unsigned short::SetValue(int, unsigned short const)
-ScDocument::GetFormattedAndUsedArea(short, short, int) const
-ScDocument::InitializeAllNoteCaptions(bool)
 ScTabView::HideCursor()
 
ScVbaFormatooo::vba::excel::XRange::setNumberFormat(com::sun::star::lang::Locale,
 rtl::OUString const)
 ScVbaFormatooo::vba::excel::XStyle::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-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 kohei.yosh...@gmail.com
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 kohei.yosh...@suse.com
+ * 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
+ * http://www.openoffice.org/license.html
+ * 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 kohei.yosh...@suse.com
+ * 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 

[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 markus.mohrh...@googlemail.com
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::minSCROW(MAXROW, nEndRow + 1);
+else
+return nRow;
+}
+else
+{
+nRow--;
+SCROW nStartRow = MAXROW;
+bool bHidden = pDocument-RowHidden(nRow, nTab, nStartRow, NULL);
+if(bHidden)
+return std::maxSCROW(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 = (nMovY0);
 
+// 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 (nIndexnLastIndex)
+SCROW nLastRow;
+nLastRow = nNextRow;
+do
 {
-++nIndex;
-while (nIndexnLastIndex  maItems[nIndex].nRow==nLast+1
- !maItems[nIndex].pCell-IsBlank())
-{
-++nIndex;
-++nLast;
-}
-if (nIndex==nLastIndex)
-if (maItems[nIndex].nRow==nLast+1  
!maItems[nIndex].pCell-IsBlank())
-++nLast;
+nNextRow = FindNextVisibleRow(nLastRow, bForward);
+

[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 kohei.yosh...@gmail.com
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::Sequencesal_Int8 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
  * inot/i 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 PivotTableFilterPivotTableFilterVector;
@@ -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( 

[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 kohei.yosh...@gmail.com
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::setSCROW rBreaks, 
SCTAB nTab, bool bPage, bool bManual) const;
 SC_DLLPUBLIC void   GetAllColBreaks(::std::setSCCOL 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_castSCTAB(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_castSCTAB(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_castsal_uInt8(~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 =
-

[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 kohei.yosh...@gmail.com
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_castSCTAB(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_castsal_uInt8(~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-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 er...@redhat.com
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 markus.mohrh...@googlemail.com
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 

[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 soerenmoeller2...@gmail.com
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 tools/datetime.hxx
-#include tools/string.hxx
 #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_castsal_Bool(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
+++ 

[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 kohei.yosh...@gmail.com
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::Sequencertl::OUString GetRegisteredSources();
 static 
com::sun::star::uno::Referencecom::sun::star::sheet::XDimensionsSupplier
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 boost/ptr_container/ptr_vector.hpp
 #include boost/unordered_map.hpp
+#include boost/unordered_set.hpp
 #include boost/scoped_ptr.hpp
 
 #include com/sun/star/sheet/XDimensionsSupplier.hpp
@@ -122,6 +123,7 @@ private:
 ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pLayoutInfo; // (level)
 
 public:
+typedef boost::unordered_setrtl::OUString, rtl::OUStringHash 
MemberSetType;
 typedef boost::unordered_map rtl::OUString, ScDPSaveMember*, 
rtl::OUStringHash MemberHash;
 typedef std::list ScDPSaveMember* 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 

[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 er...@redhat.com
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-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 kohei.yosh...@gmail.com
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_castType(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 er...@redhat.com
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 mst...@redhat.com
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 cppuhelper/implbase2.hxx
 #include cppuhelper/implbase3.hxx
 #include boost/ptr_container/ptr_vector.hpp
+#include boost/scoped_ptr.hpp
 
 #include vector
 
@@ -130,9 +131,6 @@ typedef ::com::sun::star::uno::Reference
 ::com::sun::star::util::XModifyListener  XModifyListenerRef;
 typedef boost::ptr_vectorXModifyListenerRef XModifyListenerArr_Impl;
 
-class ScNamedEntry;
-typedef boost::ptr_vectorScNamedEntry 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_ptrImpl 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::Referenceuno:
 
 //
 
-ScCellRangesObj::ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList rR) :
-ScCellRangesBase( pDocSh, rR )
+typedef boost::ptr_vectorScNamedEntry 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; nnNamedCount; n++)
-if ( aNamedEntries[n].GetName() == aNamStr )
+size_t nNamedCount = m_pImpl-m_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; nnCount  !bValid; n++)
-if (aNamedEntries[n].GetName() == aNameStr)
+if (m_pImpl-m_aNamedEntries[n].GetName() == aNameStr)
 {
 aDiff.RemoveAll();
-aDiff.Append( aNamedEntries[n].GetRange() );
+   

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

2012-06-12 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 markus.mohrh...@googlemail.com
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_castsal_Int32(50)));
+else
+
maEdMin.SetText(rtl::OUString::valueOf(static_castsal_Int32(0)));
+}
+}
+
+sal_Int32 nSelectMax = maLbTypeMax.GetSelectEntryPos();
+if(nSelectMax == 0 || nSelectMax == 1)
+maEdMax.Disable();
+else
+{
+maEdMax.Enable();
+if(!maEdMax.GetText().Len())
+{
+if(nSelectMax == 2 || 

[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 markus.mohrh...@googlemail.com
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 kohei.yosh...@gmail.com
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_vectorScQueryEntry 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_vectorScQueryEntry 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_castSCCOL(rEntry.nField);
 
 // we can only handle one single direct query
-if ( !pCell || i  0 )
+if (!pCell || it != itBeg)
 pCell = GetCell(nCol, nRow);
 
 std::pairbool,bool 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_functionScQueryEntry, 
bool
 
 }
 
+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

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 markus.mohrh...@googlemail.com
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 tools/color.hxx
 #include rangelst.hxx
 
+#include vector
+
 //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::vectordouble 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::vectordouble 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_castScFormulaCell*(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 

[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 kohei.yosh...@gmail.com
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::vectorScTypedStrData rStrings, bool rHasDates);
 bool GetDataEntries(SCROW nRow, std::setScTypedStrData 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?
+

[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 kohei.yosh...@gmail.com
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, 

[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 markus.mohrh...@googlemail.com
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 

[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 markus.mohrh...@googlemail.com
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::minSCTAB(nOldTab, nNewTab);
 SCTAB nMaxTab = std::maxSCTAB(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 markus.mohrh...@googlemail.com
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_vectorScColorScaleEntry 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 svx/framelinkarray.hxx
 #include global.hxx
-#include boost/shared_ptr.hpp
 
 class SfxItemSet;
 class SvxBrushItem;
@@ -69,7 +68,7 @@ struct CellInfo
 
 const ScPatternAttr*pPatternAttr;
 const SfxItemSet*   pConditionSet;
-boost::shared_ptrColorpColorScale;
+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 iostream
-
 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);
 
 

[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 j_cat...@yahoo.com
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_iteratorvoid**,
 std::__cxx1998::vectorvoid*, std::allocatorvoid*  , 
std::__debug::vectorvoid*, std::allocatorvoid*  , 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


[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 kohei.yosh...@gmail.com
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::ReferenceSvxUnoText 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::Referencetext::XText());
-pUnoText-acquire();
+mxUnoText.set(new SvxUnoText(aEditSrc, lcl_GetHdFtPropertySet(), 
uno::Referencetext::XText()));
 }
 }
 
-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::Referencetext::XTextCursor 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::Referencetext::XT
 throw(uno::RuntimeException)
 {
 SolarMutexGuard aGuard;
-if (!pUnoText)
+if (!mxUnoText.is())
 CreateUnoText_Impl();
-pUnoText-insertString( 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::Referencetext::XText SAL_CALL ScHeaderFooterTextObj::getText() 
throw(uno::RuntimeException)
 {
 SolarMutexGuard aGuard;
-if (!pUnoText)
+if (!mxUnoText.is())
 CreateUnoText_Impl();
-return pUnoText-getText();
+return mxUnoText-getText();
 }
 
 uno::Referencetext::XTextRange SAL_CALL 

[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 kohei.yosh...@gmail.com
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::Referencecom::sun::star::text::XTextRange 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::Referencecom::sun::star::text::XTextRange 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::Referencecontainer::XEnumerationAccess SAL_CALL 
ScCellObj::getTextFields(
 SolarMutexGuard aGuard;
 ScDocShell* pDocSh = GetDocShell();
 if ( pDocSh )
-return new ScCellFieldsObj( pDocSh, aCellPos );
+{
+uno::Referencetext::XTextRange 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::Referencetext::XTextRange xContent,
+ScDocShell* pDocSh, const ScAddress rPos) :
+mxContent(xContent),
 pDocShell( pDocSh ),
 aCellPos( rPos ),
 mpRefreshListeners( NULL )
@@ -353,16 +356,13 @@ uno::Referencetext::XTextField 
ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3
 if (!pData)
 return uno::Referencetext::XTextField();
 
-// Get the parent text range instance.
-uno::Referencetext::XTextRange 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::Referencetext::XTextField 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 unusedcode.easy

2012-04-24 Thread Caolán McNamara
 sc/inc/dpitemdata.hxx  |2 --
 sc/source/core/data/dpitemdata.cxx |9 -
 unusedcode.easy|2 --
 3 files changed, 13 deletions(-)

New commits:
commit 858646a5eb5eae8703cfb64cd1cdbc553699a224
Author: Santiago Martinez smvar...@gmail.com
Date:   Mon Apr 23 19:24:37 2012 +0200

Remove unused code in dpitemdata.

diff --git a/sc/inc/dpitemdata.hxx b/sc/inc/dpitemdata.hxx
index 1996d68..46642a9 100644
--- a/sc/inc/dpitemdata.hxx
+++ b/sc/inc/dpitemdata.hxx
@@ -87,7 +87,6 @@ public:
 ScDPItemData();
 ScDPItemData(const ScDPItemData r);
 ScDPItemData(const rtl::OUString rStr);
-ScDPItemData(const rtl::OUString* pStr);
 ScDPItemData(sal_Int32 nGroupType, sal_Int32 nValue);
 ~ScDPItemData();
 
@@ -98,7 +97,6 @@ public:
 void SetRangeStart(double fVal);
 void SetRangeFirst();
 void SetRangeLast();
-void SetErrorString(const rtl::OUString rS);
 void SetErrorString(const rtl::OUString* pS);
 bool IsCaseInsEqual(const ScDPItemData r) const;
 
diff --git a/sc/source/core/data/dpitemdata.cxx 
b/sc/source/core/data/dpitemdata.cxx
index 83ca357..1bcc3a6 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -121,9 +121,6 @@ void ScDPItemData::DisposeString()
 ScDPItemData::ScDPItemData(const rtl::OUString rStr) :
 mpString(new rtl::OUString(rStr)), meType(String), mbStringInterned(false) 
{}
 
-ScDPItemData::ScDPItemData(const rtl::OUString* pStr) :
-mpString(pStr), meType(String), mbStringInterned(true) {}
-
 ScDPItemData::ScDPItemData(sal_Int32 nGroupType, sal_Int32 nValue) :
 meType(GroupValue), mbStringInterned(false)
 {
@@ -184,12 +181,6 @@ void ScDPItemData::SetRangeLast()
 meType = RangeStart;
 }
 
-void ScDPItemData::SetErrorString(const rtl::OUString rS)
-{
-SetString(rS);
-meType = Error;
-}
-
 void ScDPItemData::SetErrorString(const rtl::OUString* pS)
 {
 SetString(pS);
diff --git a/unusedcode.easy b/unusedcode.easy
index 046ba9a..a96ce89 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -56,8 +56,6 @@ ScConditionalFormats_Impl::Remove(unsigned short, unsigned 
short)
 ScCsvControl::ScCsvControl(Window*, ScCsvLayoutData const, long)
 
ScDBCollection::AnonDBs::erase(boost::void_ptr_iterator__gnu_debug::_Safe_iterator__gnu_cxx::__normal_iteratorvoid**,
 std::__cxx1998::vectorvoid*, std::allocatorvoid*  , 
std::__debug::vectorvoid*, std::allocatorvoid*  , ScDBData)
 ScDBCollection::AnonDBs::findByTable(short) const
-ScDPItemData::ScDPItemData(rtl::OUString const*)
-ScDPItemData::SetErrorString(rtl::OUString const)
 ScDPLabelData::ScDPLabelData(rtl::OUString const, short, bool)
 ScDPObject::HasGroups() const
 ScDocRowHeightUpdater::TabRanges::TabRanges()
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-04-22 Thread Markus Mohrhard
 sc/inc/tokenarray.hxx |3 ++-
 sc/source/core/data/cell.cxx  |7 ---
 sc/source/core/tool/token.cxx |   14 +++---
 3 files changed, 13 insertions(+), 11 deletions(-)

New commits:
commit bba176a844bd993cf7fe6acce9ff18027870dfa5
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Apr 23 01:15:01 2012 +0200

only update absolute refs when copying between docs, fdo#48482

The copy/paste formulas code is getting a bit complex. I will try to
write some test cases for it.

diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 48bf4c5..cc55936 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -108,8 +108,9 @@ public:
 
 /**
  * Make all absolute references pointing to the copied range if the range 
is copied too
+ * @param bCheckCopyArea should references pointing into the copy area be 
adjusted independently from being absolute, should be true only for copypaste 
between documents
  */
-void AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddress 
rOldPos, const ScAddress rNewPos, bool bRangeName = false );
+void AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddress 
rOldPos, const ScAddress rNewPos, bool bRangeName = false, bool bCheckCopyArea 
= false );
 };
 
 #endif // SC_TOKENARRAY_HXX
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index a4e5361..fd9499b 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -175,7 +175,7 @@ void adjustRangeName(ScToken* pToken, ScDocument rNewDoc, 
const ScDocument* pOl
 if (rNewDoc.GetPool() != const_castScDocument*(pOldDoc)-GetPool())
 {
 pRangeNameToken-ReadjustAbsolute3DReferences(pOldDoc, rNewDoc, 
pRangeData-GetPos(), true);
-pRangeNameToken-AdjustAbsoluteRefs(pOldDoc, aOldPos, aNewPos, 
true);
+pRangeNameToken-AdjustAbsoluteRefs(pOldDoc, aOldPos, aNewPos, 
false, true);
 }
 
 bool bInserted;
@@ -811,12 +811,13 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell rCell, 
ScDocument rDoc, cons
 }
 }
 
-if (pDocument-GetPool() != rCell.pDocument-GetPool())
+bool bCopyBetweenDocs = pDocument-GetPool() != 
rCell.pDocument-GetPool();
+if (bCopyBetweenDocs)
 {
 pCode-ReadjustAbsolute3DReferences( rCell.pDocument, rDoc, 
rCell.aPos);
 }
 
-pCode-AdjustAbsoluteRefs( rCell.pDocument, rCell.aPos, aPos );
+pCode-AdjustAbsoluteRefs( rCell.pDocument, rCell.aPos, aPos, false, 
bCopyBetweenDocs );
 }
 
 if ( nCloneFlags  SC_CLONECELL_ADJUST3DREL )
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 0bbb3d6..dc88df1 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1832,7 +1832,7 @@ bool IsInCopyRange( const ScRange rRange, const 
ScDocument* pClipDoc )
 return rClipParam.maRanges.In(rRange);
 }
 
-bool SkipReference(ScToken* pToken, const ScAddress rPos, const ScDocument* 
pOldDoc, bool bRangeName)
+bool SkipReference(ScToken* pToken, const ScAddress rPos, const ScDocument* 
pOldDoc, bool bRangeName, bool bCheckCopyArea)
 {
 ScRange aRange;
 
@@ -1862,7 +1862,7 @@ bool SkipReference(ScToken* pToken, const ScAddress 
rPos, const ScDocument* pOl
 }
 }
 
-if (IsInCopyRange(aRange, pOldDoc))
+if (bCheckCopyArea  IsInCopyRange(aRange, pOldDoc))
 return true;
 
 return false;
@@ -1894,7 +1894,7 @@ void ScTokenArray::ReadjustAbsolute3DReferences( const 
ScDocument* pOldDoc, cons
 {
 case svDoubleRef :
 {
-if (SkipReference(static_castScToken*(pCode[j]), rPos, 
pOldDoc, bRangeName))
+if (SkipReference(static_castScToken*(pCode[j]), rPos, 
pOldDoc, bRangeName, true))
 continue;
 
 ScComplexRefData rRef = 
static_castScToken*(pCode[j])-GetDoubleRef();
@@ -1915,7 +1915,7 @@ void ScTokenArray::ReadjustAbsolute3DReferences( const 
ScDocument* pOldDoc, cons
 break;
 case svSingleRef :
 {
-if (SkipReference(static_castScToken*(pCode[j]), rPos, 
pOldDoc, bRangeName))
+if (SkipReference(static_castScToken*(pCode[j]), rPos, 
pOldDoc, bRangeName, true))
 continue;
 
 ScSingleRefData rRef = 
static_castScToken*(pCode[j])-GetSingleRef();
@@ -1941,7 +1941,7 @@ void ScTokenArray::ReadjustAbsolute3DReferences( const 
ScDocument* pOldDoc, cons
 }
 }
 
-void ScTokenArray::AdjustAbsoluteRefs( const ScDocument* pOldDoc, const 
ScAddress rOldPos, const ScAddress rNewPos, bool bRangeName)
+void ScTokenArray::AdjustAbsoluteRefs( const ScDocument* pOldDoc, const 
ScAddress rOldPos, const ScAddress rNewPos, bool bRangeName, bool 
bCheckCopyRange)
 {
 for ( sal_uInt16 j=0; jnLen; ++j )
 {
@@ -1949,7 +1949,7 @@ void ScTokenArray::AdjustAbsoluteRefs( const ScDocument* 

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

2012-04-19 Thread Eike Rathke
 sc/inc/compiler.hxx  |7 ++
 sc/inc/rangenam.hxx  |2 -
 sc/source/core/data/table1.cxx   |8 ---
 sc/source/core/tool/compiler.cxx |   43 ---
 sc/source/core/tool/rangenam.cxx |2 -
 5 files changed, 32 insertions(+), 30 deletions(-)

New commits:
commit 409f11ae387c859dcf9275c08093649a676e1f9e
Author: Eike Rathke er...@redhat.com
Date:   Thu Apr 19 23:26:16 2012 +0200

fdo#48856 update sheet-local named expressions correctly

* Named expression must be updated before any formulas that would access 
them.
* Handle all ocName tokens differentiating between global and sheet-local
  names.

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index b83448b..58a3c6c 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -364,6 +364,13 @@ private:
 
 void SetRelNameReference();
 
+/** Obtain range data for ocName token, global or sheet local.
+
+Prerequisite: rToken is a FormulaIndexToken so IsGlobal() and
+GetIndex() can be called on it. We don't check with RTTI.
+ */
+ScRangeData* GetRangeData( const formula::FormulaToken pToken ) const;
+
 static void InitCharClassEnglish();
 
 public:
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 2e3c007..dfb7d9e 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -201,7 +201,7 @@ public:
 SC_DLLPUBLIC const ScRangeData* findByRange(const ScRange rRange) const;
 SC_DLLPUBLIC ScRangeData* findByUpperName(const rtl::OUString rName);
 SC_DLLPUBLIC const ScRangeData* findByUpperName(const rtl::OUString 
rName) const;
-SC_DLLPUBLIC ScRangeData* findByIndex(sal_uInt16 i);
+SC_DLLPUBLIC ScRangeData* findByIndex(sal_uInt16 i) const;
 void UpdateReference(UpdateRefMode eUpdateRefMode, const ScRange rRange,
  SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bLocal = 
false);
 void UpdateTabRef(SCTAB nTable, sal_uInt16 nFlag, SCTAB nNewTable = 0, 
SCTAB nNewSheets = 1);
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index acf5205..40cc82c 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1372,16 +1372,18 @@ void ScTable::UpdateReference( UpdateRefMode 
eUpdateRefMode, SCCOL nCol1, SCROW
 i = 0;
 iMax = MAXCOL;
 }
-for ( ; i=iMax; i++)
-bUpdated |= aCol[i].UpdateReference(
-eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, 
nDy, nDz, pUndoDoc );
 
+// Named expressions need to be updated before formulas acessing them.
 if (mpRangeName)
 {
 ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );;
 mpRangeName-UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz, 
true );
 }
 
+for ( ; i=iMax; i++)
+bUpdated |= aCol[i].UpdateReference(
+eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, 
nDy, nDz, pUndoDoc );
+
 if ( bIncludeDraw )
 UpdateDrawRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, 
nTab2, nDx, nDy, nDz, bUpdateNoteCaptionPos );
 
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index be051c9..a46bd00 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3978,22 +3978,27 @@ ScTokenArray* ScCompiler::CompileString( const String 
rFormula, const String r
 }
 
 
-bool ScCompiler::HandleRange()
+ScRangeData* ScCompiler::GetRangeData( const FormulaToken rToken ) const
 {
 ScRangeData* pRangeData = NULL;
-
-bool bGlobal = pToken-IsGlobal();
+bool bGlobal = rToken.IsGlobal();
 if (bGlobal)
 // global named range.
-pRangeData = pDoc-GetRangeName()-findByIndex( pToken-GetIndex() );
+pRangeData = pDoc-GetRangeName()-findByIndex( rToken.GetIndex());
 else
 {
 // sheet local named range.
-ScRangeName* pRN = pDoc-GetRangeName(aPos.Tab());
+const ScRangeName* pRN = pDoc-GetRangeName( aPos.Tab());
 if (pRN)
-pRangeData = pRN-findByIndex( pToken-GetIndex() );
+pRangeData = pRN-findByIndex( rToken.GetIndex());
 }
+return pRangeData;
+}
+
 
+bool ScCompiler::HandleRange()
+{
+const ScRangeData* pRangeData = GetRangeData( *pToken);
 if (pRangeData)
 {
 sal_uInt16 nErr = pRangeData-GetErrCode();
@@ -4118,7 +4123,7 @@ bool ScCompiler::HasModifiedRange()
 OpCode eOpCode = t-GetOpCode();
 if ( eOpCode == ocName )
 {
-ScRangeData* pRangeData = 
pDoc-GetRangeName()-findByIndex(t-GetIndex());
+const ScRangeData* pRangeData = GetRangeData( *t);
 if (pRangeData  pRangeData-IsModified())
 return true;
 }
@@ -4239,7 +4244,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode 
eUpdateRefMode,
 {
 if( j-GetOpCode() == ocName )
 {
-ScRangeData* pName = 

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

2012-04-18 Thread Michael Meeks
 sc/inc/appoptio.hxx |5 -
 sc/inc/scmod.hxx|2 +-
 sc/source/core/tool/appoptio.cxx|4 
 sc/source/ui/vba/vbaapplication.cxx |   10 +-
 sc/source/ui/view/tabvwsh4.cxx  |   11 +--
 5 files changed, 7 insertions(+), 25 deletions(-)

New commits:
commit 27dda3134748cd0a549b75db830496539959eb90
Author: Albert Thuswaldner albert.thuswald...@gmail.com
Date:   Tue Apr 17 20:25:53 2012 +0200

Removed duplicate set/get methods for initial tab count

diff --git a/sc/inc/appoptio.hxx b/sc/inc/appoptio.hxx
index b7f5fe8..d4cc424 100644
--- a/sc/inc/appoptio.hxx
+++ b/sc/inc/appoptio.hxx
@@ -46,10 +46,6 @@ public:
 
 voidSetDefaults();
 
-// Set or get the initial tab count for new spreadsheet, it is used by VBA 
API currently.
-voidSetTabCountInNewSpreadsheet( SCTAB nCount )  { 
nTabCountInNewSpreadsheet = nCount; }
-SCTAB   GetTabCountInNewSpreadsheet() const  { return 
nTabCountInNewSpreadsheet;   }
-
 voidSetAppMetric( FieldUnit eUnit ) { eMetric = eUnit;  }
 FieldUnit   GetAppMetric() const{ return eMetric;   }
 voidSetZoom( sal_uInt16 nNew )  { nZoom = nNew; }
@@ -94,7 +90,6 @@ public:
 const ScAppOptions operator=   ( const ScAppOptions rOpt );
 
 private:
-SCTAB   nTabCountInNewSpreadsheet;
 FieldUnit   eMetric;
 sal_uInt16  nLRUFuncCount;
 sal_uInt16* pLRUList;
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 4c36f30..69bc665 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -182,7 +182,7 @@ public:
 const ScViewOptionsGetViewOptions  ();
 SC_DLLPUBLICconst ScDocOptions GetDocOptions   ();
 SC_DLLPUBLICconst ScAppOptions GetAppOptions   ();
-const ScDefaultsOptions   GetDefaultsOptions ();
+SC_DLLPUBLICconst ScDefaultsOptions   GetDefaultsOptions ();
 const ScFormulaOptions   GetFormulaOptions ();
 const ScInputOptions   GetInputOptions ();
 SC_DLLPUBLICconst ScPrintOptions   GetPrintOptions ();
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index 9b352b8..b864804 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -78,9 +78,6 @@ ScAppOptions::~ScAppOptions()
 
 void ScAppOptions::SetDefaults()
 {
-// Set default tab count for new spreadsheet.
-nTabCountInNewSpreadsheet = 0;
-
 if ( ScOptionsUtil::IsMetricSystem() )
 eMetric = FUNIT_CM; // default for countries with 
metric system
 else
@@ -118,7 +115,6 @@ void ScAppOptions::SetDefaults()
 
 const ScAppOptions ScAppOptions::operator=( const ScAppOptions rCpy )
 {
-nTabCountInNewSpreadsheet = rCpy.nTabCountInNewSpreadsheet;
 eMetric = rCpy.eMetric;
 eZoomType   = rCpy.eZoomType;
 bSynchronizeZoom = rCpy.bSynchronizeZoom;
diff --git a/sc/source/ui/vba/vbaapplication.cxx 
b/sc/source/ui/vba/vbaapplication.cxx
index d0201a4..478e8f4 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -79,7 +79,7 @@
 #include global.hxx
 #include scmod.hxx
 #include docoptio.hxx
-#include appoptio.hxx
+#include defaultsoptions.hxx
 
 #include osl/file.hxx
 #include rtl/instance.hxx
@@ -939,8 +939,8 @@ ScVbaApplication::setEnableCancelKey(sal_Int32 
/*lEnableCancelKey*/) throw (uno:
 
 sal_Int32 SAL_CALL ScVbaApplication::getSheetsInNewWorkbook() throw 
(uno::RuntimeException)
 {
-const ScAppOptions rAppOpt = SC_MOD()-GetAppOptions();
-return rAppOpt.GetTabCountInNewSpreadsheet();
+const ScDefaultsOptions rOpt = SC_MOD()-GetDefaultsOptions();
+return rOpt.GetInitTabCount();
 }
 
 void SAL_CALL ScVbaApplication::setSheetsInNewWorkbook( sal_Int32 
SheetsInNewWorkbook ) throw (script::BasicErrorException, uno::RuntimeException)
@@ -952,8 +952,8 @@ void SAL_CALL ScVbaApplication::setSheetsInNewWorkbook( 
sal_Int32 SheetsInNewWor
 }
 else
 {
-ScAppOptions rAppOpt = const_cast ScAppOptions 
(SC_MOD()-GetAppOptions());
-rAppOpt.SetTabCountInNewSpreadsheet( SheetsInNewWorkbook );
+ScDefaultsOptions rOpt = const_cast ScDefaultsOptions 
(SC_MOD()-GetDefaultsOptions());
+rOpt.SetInitTabCount( SheetsInNewWorkbook );
 }
 }
 
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 4cf2624..238d124 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1605,19 +1605,10 @@ void ScTabViewShell::Construct( sal_uInt8 
nForceDesignMode )
 // append additional sheets (not for OLE object)
 if ( pDocSh-GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
 {
-// Get the customized initial tab count...
-
-// ... from option dialog.
+// Get the customized initial tab count
 const ScDefaultsOptions rOpt = SC_MOD()-GetDefaultsOptions();
 

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

2012-04-17 Thread Kohei Yoshida
 sc/inc/printopt.hxx  |4 ++--
 sc/inc/viewopti.hxx  |4 ++--
 sc/source/core/tool/printopt.cxx |4 ++--
 sc/source/core/tool/viewopti.cxx |2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 3ef53adf7eb7ea68fe4ba5b8f4fee8a7c6014756
Author: Albert Thuswaldner albert.thuswald...@gmail.com
Date:   Sun Apr 15 17:15:20 2012 +0200

Have operators of ScViewOptions and ScPrintOptions return bool instead of 
int

diff --git a/sc/inc/printopt.hxx b/sc/inc/printopt.hxx
index 5883e7c..8e32b7c 100644
--- a/sc/inc/printopt.hxx
+++ b/sc/inc/printopt.hxx
@@ -52,8 +52,8 @@ public:
 voidSetDefaults();
 
 const ScPrintOptions   operator=  ( const ScPrintOptions rCpy );
-int operator== ( const ScPrintOptions rOpt ) const;
-int operator!= ( const ScPrintOptions rOpt ) const;
+booloperator== ( const ScPrintOptions rOpt ) const;
+booloperator!= ( const ScPrintOptions rOpt ) const;
 };
 
 //==
diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index 0c763ce..b82f566 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -83,8 +83,8 @@ public:
 
 voidSetDefaults();
 const ScGridOptionsoperator=  ( const ScGridOptions rCpy );
-int operator== ( const ScGridOptions rOpt ) const;
-int operator!= ( const ScGridOptions rOpt ) const { 
return !(operator==(rOpt)); }
+booloperator== ( const ScGridOptions rOpt ) const;
+booloperator!= ( const ScGridOptions rOpt ) const { 
return !(operator==(rOpt)); }
 };
 
 //==
diff --git a/sc/source/core/tool/printopt.cxx b/sc/source/core/tool/printopt.cxx
index 095e594..215989b 100644
--- a/sc/source/core/tool/printopt.cxx
+++ b/sc/source/core/tool/printopt.cxx
@@ -74,13 +74,13 @@ const ScPrintOptions ScPrintOptions::operator=( const 
ScPrintOptions rCpy )
 return *this;
 }
 
-int ScPrintOptions::operator==( const ScPrintOptions rOpt ) const
+bool ScPrintOptions::operator==( const ScPrintOptions rOpt ) const
 {
 return bSkipEmpty == rOpt.bSkipEmpty
  bAllSheets == rOpt.bAllSheets;
 }
 
-int ScPrintOptions::operator!=( const ScPrintOptions rOpt ) const
+bool ScPrintOptions::operator!=( const ScPrintOptions rOpt ) const
 {
 return !(operator==(rOpt));
 }
diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index 7c40d22..b20c57d 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -105,7 +105,7 @@ const ScGridOptions ScGridOptions::operator=( const 
ScGridOptions rCpy )
 
 //
 
-int ScGridOptions::operator==( const ScGridOptions rCpy ) const
+bool ScGridOptions::operator==( const ScGridOptions rCpy ) const
 {
 return (   nFldDrawX== rCpy.nFldDrawX
  nFldDivisionX== rCpy.nFldDivisionX
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-04-15 Thread Eike Rathke
 sc/inc/stringutil.hxx  |   10 ++
 sc/source/core/data/column3.cxx|   21 +
 sc/source/core/data/dpoutput.cxx   |3 +++
 sc/source/core/tool/stringutil.cxx |3 ++-
 sc/source/filter/rtf/eeimpars.cxx  |1 +
 sc/source/ui/docshell/impex.cxx|1 +
 6 files changed, 30 insertions(+), 9 deletions(-)

New commits:
commit 5a560e4300295629592716697f13bc803bdeba3c
Author: Eike Rathke er...@redhat.com
Date:   Sun Apr 15 14:56:55 2012 +0200

resolved fdo#48731 in CSV import do not strip leading apostrophe

diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx
index 66b68a2..245714f 100644
--- a/sc/inc/stringutil.hxx
+++ b/sc/inc/stringutil.hxx
@@ -61,6 +61,16 @@ struct SC_DLLPUBLIC ScSetStringParam
  */
 bool mbSetTextCellFormat;
 
+/**
+ * When true, treat input with a leading apostrophe / single quote special
+ * in that it escapes numeric or date/time input such that it is not
+ * interpreted and the input string is taken instead. This can be used
+ * during text file import so the leading apostrophe is not lost if it
+ * precedes a numeric value.
+ * Usually set mbHandleApostrophe = !mbSetTextCellFormat
+ */
+bool mbHandleApostrophe;
+
 ScSetStringParam();
 };
 
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 8f6397e..0e48e9b 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1234,14 +1234,19 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, 
const String rString,
 }
 else if ( cFirstChar == '\'')   // 'Text
 {
-// Cell format is not 'Text', and the first char
-// is an apostrophe.  Check if the input is considered a number.
-String aTest = rString.Copy(1);
-double fTest;
-if (aParam.mpNumFormatter-IsNumberFormat(aTest, nIndex, fTest))
-// This is a number.  Strip out the first char.
-pNewCell = new ScStringCell(aTest);
-else
+bool bNumeric = false;
+if (aParam.mbHandleApostrophe)
+{
+// Cell format is not 'Text', and the first char
+// is an apostrophe.  Check if the input is considered a 
number.
+String aTest = rString.Copy(1);
+double fTest;
+bNumeric = aParam.mpNumFormatter-IsNumberFormat(aTest, 
nIndex, fTest);
+if (bNumeric)
+// This is a number.  Strip out the first char.
+pNewCell = new ScStringCell(aTest);
+}
+if (!bNumeric)
 // This is a normal text. Take it as-is.
 pNewCell = new ScStringCell(rString);
 }
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index f903f0d..875371f 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -794,11 +794,13 @@ void ScDPOutput::HeaderCell( SCCOL nCol, SCROW nRow, 
SCTAB nTab,
 {
 aParam.mbDetectNumberFormat = true;
 aParam.mbSetTextCellFormat = false;
+aParam.mbHandleApostrophe = true;
 }
 else
 {
 aParam.mbDetectNumberFormat = false;
 aParam.mbSetTextCellFormat = true;
+aParam.mbHandleApostrophe = false;
 }
 pDoc-SetString(nCol, nRow, nTab, rData.Caption, aParam);
 }
@@ -836,6 +838,7 @@ void ScDPOutput::FieldCell(
 ScSetStringParam aParam;
 aParam.mbDetectNumberFormat = false;
 aParam.mbSetTextCellFormat = true;
+aParam.mbHandleApostrophe = false;
 pDoc-SetString(nCol, nRow, nTab, rData.maCaption, aParam);
 
 if (bInTable)
diff --git a/sc/source/core/tool/stringutil.cxx 
b/sc/source/core/tool/stringutil.cxx
index 263e22c..a4cb4b3 100644
--- a/sc/source/core/tool/stringutil.cxx
+++ b/sc/source/core/tool/stringutil.cxx
@@ -39,7 +39,8 @@ using ::rtl::OUStringBuffer;
 ScSetStringParam::ScSetStringParam() :
 mpNumFormatter(NULL),
 mbDetectNumberFormat(true),
-mbSetTextCellFormat(false)
+mbSetTextCellFormat(false),
+mbHandleApostrophe(true)
 {
 }
 
diff --git a/sc/source/filter/rtf/eeimpars.cxx 
b/sc/source/filter/rtf/eeimpars.cxx
index 36ece2b..2ecf7dd 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -337,6 +337,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, 
double nOutputFactor, SvNu
 aParam.mpNumFormatter = pFormatter;
 aParam.mbDetectNumberFormat = true;
 aParam.mbSetTextCellFormat = true;
+aParam.mbHandleApostrophe = false;
 
 if (!aValStr.isEmpty())
 mpDoc-SetValue( nCol, nRow, nTab, fVal );
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index cf51c07..f9d00ab 100644
--- 

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

2012-04-10 Thread Eike Rathke
 sc/inc/filter.hxx |8 -
 sc/source/filter/html/htmlexp.cxx |2 
 sc/source/filter/html/htmlimp.cxx |8 -
 sc/source/filter/inc/eeimport.hxx |2 
 sc/source/filter/inc/ftools.hxx   |6 -
 sc/source/filter/inc/htmlimp.hxx  |2 
 sc/source/filter/rtf/eeimpars.cxx |2 
 sc/source/ui/docshell/impex.cxx   |  200 +++---
 sc/source/ui/inc/impex.hxx|   94 -
 9 files changed, 162 insertions(+), 162 deletions(-)

New commits:
commit dd6e7fb5b31d9801977e16d853963ddcf0794a27
Author: Eike Rathke er...@redhat.com
Date:   Tue Apr 10 21:03:26 2012 +0200

sal_Bool to bool

diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index eb6229d..80dace2 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -88,7 +88,7 @@ class ScEEAbsImport {
 virtual sal_uLong   Read( SvStream rStream, const String rBaseURL ) = 0;
 virtual ScRange GetRange() = 0;
 virtual voidWriteToDocument(
-sal_Bool bSizeColsRows = false, double nOutputFactor = 1.0,
+bool bSizeColsRows = false, double nOutputFactor = 1.0,
 SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
 };
 
@@ -107,11 +107,11 @@ class ScFormatFilterPlugin {
  const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, sal_uInt32 
nDifOption = SC_DIFOPT_EXCEL ) = 0;
 virtual FltError ScImportRTF( SvStream, const String rBaseURL, 
ScDocument*, ScRange rRange ) = 0;
 virtual FltError ScImportHTML( SvStream, const String rBaseURL, 
ScDocument*, ScRange rRange, double nOutputFactor = 1.0,
-   sal_Bool bCalcWidthHeight = sal_True, 
SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
+   bool bCalcWidthHeight = true, 
SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
 
 // various import helpers
 virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange 
rRange ) = 0;
-virtual ScEEAbsImport *CreateHTMLImport( ScDocument* pDocP, const String 
rBaseURL, const ScRange rRange, sal_Bool bCalcWidthHeight ) = 0;
+virtual ScEEAbsImport *CreateHTMLImport( ScDocument* pDocP, const String 
rBaseURL, const ScRange rRange, bool bCalcWidthHeight ) = 0;
 virtual String GetHTMLRangeNameList( ScDocument* pDoc, const 
String rOrigName ) = 0;
 
 // various export filters
@@ -123,7 +123,7 @@ class ScFormatFilterPlugin {
  sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
 virtual FltError ScExportDif( SvStream, ScDocument*, const ScRange 
rRange, const CharSet eDest,
  sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
-virtual FltError ScExportHTML( SvStream, const String rBaseURL, 
ScDocument*, const ScRange rRange, const CharSet eDest, sal_Bool bAll,
+virtual FltError ScExportHTML( SvStream, const String rBaseURL, 
ScDocument*, const ScRange rRange, const CharSet eDest, bool bAll,
   const String rStreamPath, String rNonConvertibleChars ) = 
0;
 virtual FltError ScExportRTF( SvStream, ScDocument*, const ScRange 
rRange, const CharSet eDest ) = 0;
 
diff --git a/sc/source/filter/html/htmlexp.cxx 
b/sc/source/filter/html/htmlexp.cxx
index af0689a..a8aa11b 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -148,7 +148,7 @@ const sal_Char ScHTMLExport::sIndentSource[nIndentMax+1] =
 //
 
 FltError ScFormatFilterPluginImpl::ScExportHTML( SvStream rStrm, const 
String rBaseURL, ScDocument* pDoc,
-const ScRange rRange, const CharSet /*eNach*/, sal_Bool bAll,
+const ScRange rRange, const CharSet /*eNach*/, bool bAll,
 const String rStreamPath, String rNonConvertibleChars )
 {
 ScHTMLExport aEx( rStrm, rBaseURL, pDoc, rRange, bAll, rStreamPath );
diff --git a/sc/source/filter/html/htmlimp.cxx 
b/sc/source/filter/html/htmlimp.cxx
index 34b13ae..0b953ec 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -60,18 +60,18 @@
 //
 
 FltError ScFormatFilterPluginImpl::ScImportHTML( SvStream rStream, const 
String rBaseURL, ScDocument *pDoc,
-ScRange rRange, double nOutputFactor, sal_Bool bCalcWidthHeight, 
SvNumberFormatter* pFormatter,
+ScRange rRange, double nOutputFactor, bool bCalcWidthHeight, 
SvNumberFormatter* pFormatter,
 bool bConvertDate )
 {
 ScHTMLImport aImp( pDoc, rBaseURL, rRange, bCalcWidthHeight );
 FltError nErr = (FltError) aImp.Read( rStream, rBaseURL );
 ScRange aR = aImp.GetRange();
 rRange.aEnd = aR.aEnd;
-aImp.WriteToDocument( sal_True, nOutputFactor, pFormatter, bConvertDate );
+aImp.WriteToDocument( true, nOutputFactor, pFormatter, bConvertDate );
 return nErr;
 }
 
-ScEEAbsImport 

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

2012-04-10 Thread Eike Rathke
 sc/inc/scerrors.hxx |5 +-
 sc/source/ui/dbgui/csvgrid.cxx  |5 ++
 sc/source/ui/docshell/docsh.cxx |   16 ++---
 sc/source/ui/docshell/impex.cxx |   70 +---
 sc/source/ui/inc/impex.hxx  |   13 +--
 sc/source/ui/src/scerrors.src   |4 ++
 6 files changed, 77 insertions(+), 36 deletions(-)

New commits:
commit 684cf5cca6ea6c8fc2743f1622f624f668db9e84
Author: Eike Rathke er...@redhat.com
Date:   Tue Apr 10 23:50:29 2012 +0200

resolved fdo#48516 use max columns exceeded message if appropriate

In CSV import, instead of SCWARN_IMPORT_RANGE_OVERFLOW use
SCWARN_IMPORT_ROW_OVERFLOW and SCWARN_IMPORT_COLUMN_OVERFLOW that already
existed, additionally introduced SCWARN_IMPORT_CELL_OVERFLOW if single field
data exceeds STRING_MAXLEN.

Row overflow takes precedence over column overflow that takes precedence 
over
cell overflow.

diff --git a/sc/inc/scerrors.hxx b/sc/inc/scerrors.hxx
index fc6b9cb..ea7e590 100644
--- a/sc/inc/scerrors.hxx
+++ b/sc/inc/scerrors.hxx
@@ -60,9 +60,10 @@
 
 // ERRCODE_CLASS_IMPORT - does not display Read-Error in MsgBox
 #define SCWARN_IMPORT_RANGE_OVERFLOW (  1 | ERRCODE_CLASS_IMPORT | 
ERRCODE_WARNING_MASK | ERRCODE_AREA_SC )
-#define SCWARN_IMPORT_ROW_OVERFLOW (  2 | ERRCODE_CLASS_IMPORT | 
ERRCODE_WARNING_MASK | ERRCODE_AREA_SC )
-#define SCWARN_IMPORT_COLUMN_OVERFLOW (  3 | ERRCODE_CLASS_IMPORT | 
ERRCODE_WARNING_MASK | ERRCODE_AREA_SC )
+#define SCWARN_IMPORT_ROW_OVERFLOW  (   2 | ERRCODE_CLASS_IMPORT | 
ERRCODE_WARNING_MASK | ERRCODE_AREA_SC )
+#define SCWARN_IMPORT_COLUMN_OVERFLOW ( 3 | ERRCODE_CLASS_IMPORT | 
ERRCODE_WARNING_MASK | ERRCODE_AREA_SC )
 #define SCWARN_IMPORT_SHEET_OVERFLOW (  4 | ERRCODE_CLASS_IMPORT | 
ERRCODE_WARNING_MASK | ERRCODE_AREA_SC )
+#define SCWARN_IMPORT_CELL_OVERFLOW (   5 | ERRCODE_CLASS_IMPORT | 
ERRCODE_WARNING_MASK | ERRCODE_AREA_SC )
 
 // ERRCODE_CLASS_EXPORT - does not display Write-Error in MsgBox
 #define SCWARN_EXPORT_NONCONVERTIBLE_CHARS  (   1 | ERRCODE_CLASS_EXPORT | 
ERRCODE_WARNING_MASK | ERRCODE_AREA_SC )
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index 09d3651..68c6fd9 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -750,7 +750,10 @@ void ScCsvGrid::ImplSetTextLineSep(
 {
 // scan for next cell text
 bool bIsQuoted = false;
-pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, 
cTextSep, pSepChars, bMergeSep, bIsQuoted );
+bool bOverflowCell = false;
+pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText,
+cTextSep, pSepChars, bMergeSep, bIsQuoted, bOverflowCell );
+/* TODO: signal overflow somewhere in UI */
 
 // update column width
 sal_Int32 nWidth = Max( CSV_MINCOLWIDTH, aCellText.Len() + sal_Int32( 
1 ) );
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 3e931c4..57e2ee4 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1170,7 +1170,8 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium rMedium )
 }
 
 FltError eError = eERR_OK;
-sal_Bool bOverflow = false;
+bool bOverflowRow, bOverflowCol, bOverflowCell;
+bOverflowRow = bOverflowCol = bOverflowCell = false;
 
 if( ! rMedium.IsStorage() )
 {
@@ -1186,7 +1187,9 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium rMedium )
 eError = bRet ? eERR_OK : SCERR_IMPORT_CONNECT;
 aDocument.StartAllListeners();
 aDocument.SetDirty();
-bOverflow = aImpEx.IsOverflow();
+bOverflowRow = aImpEx.IsOverflowRow();
+bOverflowCol = aImpEx.IsOverflowCol();
+bOverflowCell = aImpEx.IsOverflowCell();
 }
 else
 {
@@ -1199,10 +1202,13 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium rMedium )
 if (!GetError())
 SetError(eError, ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
 }
-else if ( bOverflow )
+else if (!GetError()  (bOverflowRow || bOverflowCol || 
bOverflowCell))
 {
-if (!GetError())
-SetError(SCWARN_IMPORT_RANGE_OVERFLOW, ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
+// precedence: row, column, cell
+FltError nWarn = (bOverflowRow ? SCWARN_IMPORT_ROW_OVERFLOW :
+(bOverflowCol ? SCWARN_IMPORT_COLUMN_OVERFLOW :
+ SCWARN_IMPORT_CELL_OVERFLOW));
+SetError( nWarn, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
OSL_LOG_PREFIX ) ));
 }
 bSetColWidths = sal_True;
 bSetSimpleTextColWidths = sal_True;
diff 

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

2012-03-29 Thread Markus Mohrhard
 sc/inc/document.hxx  |5 +
 sc/source/core/data/document.cxx |3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit f826a5b56ac12e0b85c380f7d26c379e3d1f7281
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Thu Mar 29 20:36:12 2012 +0200

quick and ugly hack for ScEditableTester in ucalc

Fix this as soon as possible with a clean fix

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 6b2139b..2fbd0eb 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -419,6 +419,10 @@ private:
 
 ::std::setScFormulaCell* maSubTotalCells;
 
+// quick and ugly hack to fix the ScEditableTester problem in ucalc
+// write a clean fix for this as soon as possible
+boolmbIsInTest;
+
 public:
 SC_DLLPUBLIC sal_uLong  GetCellCount() const;   // all cells
 SCSIZE  GetCellCount(SCTAB nTab, SCCOL nCol) const;
@@ -1103,6 +1107,7 @@ public:
 bool bColInfo = false, bool bRowInfo = false );
 SC_DLLPUBLIC void   InitUndoSelected( ScDocument* pSrcDoc, const 
ScMarkData rTabSelection,
 bool bColInfo = false, bool bRowInfo = false );
+voidSetInTest() { mbIsInTest = true; }
 
 //  don't use anymore:
 voidCopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 6e21d91..ef2a8c4 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4766,7 +4766,8 @@ bool ScDocument::IsBlockEditable( SCTAB nTab, SCCOL 
nStartCol, SCROW nStartRow,
 bool* pOnlyNotBecauseOfMatrix /* = 
NULL */ ) const
 {
 // import into read-only document is possible
-if ( !bImportingXML  !mbChangeReadOnlyEnabled  pShell  
pShell-IsReadOnly() )
+// TODO: come up with a clean solution for the testing problem
+if ( !bImportingXML  !mbChangeReadOnlyEnabled  pShell  
(pShell-IsReadOnly()!mbIsInTest) )
 {
 if ( pOnlyNotBecauseOfMatrix )
 *pOnlyNotBecauseOfMatrix = false;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-03-26 Thread Markus Mohrhard
 sc/inc/attarray.hxx|2 +-
 sc/inc/column.hxx  |2 +-
 sc/inc/document.hxx|1 +
 sc/inc/table.hxx   |2 +-
 sc/source/core/data/attarray.cxx   |4 ++--
 sc/source/core/data/column2.cxx|4 ++--
 sc/source/core/data/document.cxx   |   13 +
 sc/source/core/data/table1.cxx |4 ++--
 sc/source/filter/excel/xetable.cxx |2 +-
 9 files changed, 24 insertions(+), 10 deletions(-)

New commits:
commit 5d123a0b0e827aba59ddb50ef1b961a529a34a15
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue Mar 27 05:14:06 2012 +0200

export all style information to xls/xlsx, fdo#46738

Fixes that if more than 84 empty but formatted rows at the end of a file
have been found the export skipped those rows.

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 706a1c0..c6d2aff 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -173,7 +173,7 @@ public:
 boolIsEmpty() const;
 
 boolGetFirstVisibleAttr( SCROW rFirstRow ) const;
-boolGetLastVisibleAttr( SCROW rLastRow, SCROW nLastData ) const;
+boolGetLastVisibleAttr( SCROW rLastRow, SCROW nLastData, bool 
bFullFormattedArea = false ) const;
 boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 boolIsVisibleEqual( const ScAttrArray rOther,
 SCROW nStartRow, SCROW nEndRow ) const;
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index e503005..4988ffc 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -182,7 +182,7 @@ public:
 boolHasSelectionMatrixFragment(const ScMarkData rMark) const;
 
 boolGetFirstVisibleAttr( SCROW rFirstRow ) const;
-boolGetLastVisibleAttr( SCROW rLastRow ) const;
+boolGetLastVisibleAttr( SCROW rLastRow, bool bFullFormattedArea = 
false ) const;
 boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 boolIsVisibleAttrEqual( const ScColumn rCol, SCROW nStartRow = 0,
 SCROW nEndRow = MAXROW ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 0d63e3b..bc48fab 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -935,6 +935,7 @@ 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/inc/table.hxx b/sc/inc/table.hxx
index b99caf8..cec3676 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -401,7 +401,7 @@ public:
 
 boolGetCellArea( SCCOL rEndCol, SCROW rEndRow ) const;   
 // FALSE = empty
 boolGetTableArea( SCCOL rEndCol, SCROW rEndRow ) const;
-boolGetPrintArea( SCCOL rEndCol, SCROW rEndRow, bool bNotes ) 
const;
+boolGetPrintArea( SCCOL rEndCol, SCROW rEndRow, bool bNotes, 
bool bFullFormattedArea = false ) const;
 boolGetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
 SCCOL rEndCol, bool bNotes ) const;
 boolGetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 3b0c923..72d08fc 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1760,7 +1760,7 @@ bool ScAttrArray::GetFirstVisibleAttr( SCROW rFirstRow ) 
const
 
 const SCROW SC_VISATTR_STOP = 84;
 
-bool ScAttrArray::GetLastVisibleAttr( SCROW rLastRow, SCROW nLastData ) const
+bool ScAttrArray::GetLastVisibleAttr( SCROW rLastRow, SCROW nLastData, bool 
bFullFormattedArea ) const
 {
 //  #i30830# changed behavior:
 //  ignore all attributes starting with the first run of SC_VISATTR_STOP 
equal rows
@@ -1791,7 +1791,7 @@ bool ScAttrArray::GetLastVisibleAttr( SCROW rLastRow, 
SCROW nLastData ) const
 if ( nAttrStartRow = nLastData )
 nAttrStartRow = nLastData + 1;
 SCROW nAttrSize = pData[nEndPos].nRow + 1 - nAttrStartRow;
-if ( nAttrSize = SC_VISATTR_STOP )
+if ( nAttrSize = SC_VISATTR_STOP  !bFullFormattedArea )
 {
 bFound = false;// ignore this range and below
 }
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 1ca582d..393e18e 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1429,14 +1429,14 @@ bool ScColumn::GetFirstVisibleAttr( SCROW 

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

2012-03-23 Thread Kohei Yoshida
 sc/inc/globstr.hrc|3 ++-
 sc/source/ui/src/globstr.src  |4 
 sc/source/ui/view/dbfunc3.cxx |3 +--
 3 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 35fe6b9587a22e9faa669ebab05bf577f09a3438
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Mar 23 10:36:32 2012 -0400

Localize the group prefix for pivot table defult group names.

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 5157eb6..b02d250 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -599,8 +599,9 @@
 
 #define STR_UNSAVED_EXT_REF 465
 #define STR_CLOSE_WITH_UNSAVED_REFS 466
+#define STR_PIVOT_GROUP 467
 
-#define STR_COUNT   467
+#define STR_COUNT   468
 
 
 #endif
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 164e12d..dcc4adb 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -553,6 +553,10 @@ Resource RID_GLOBSTR
 {
 Text [ en-US ] = Data ;
 };
+String STR_PIVOT_GROUP
+{
+Text [ en-US ] = Group ;
+};
 String STR_PIVOTFUNC_SUM
 {
 Text [ en-US ] = SUM ;
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index f6eb887..6742928 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1221,8 +1221,7 @@ void ScDBFunc::GroupDataPilot()
 }
 rtl::OUString aGroupDimName = pGroupDimension-GetGroupDimName();
 
-//! localized prefix string
-rtl::OUString aGroupName = pGroupDimension-CreateGroupName( 
String::CreateFromAscii(Group) );
+rtl::OUString aGroupName = 
pGroupDimension-CreateGroupName(ScGlobal::GetRscString(STR_PIVOT_GROUP));
 ScDPSaveGroupItem aGroup( aGroupName );
 ScDPUniqueStringSet::const_iterator it = aEntries.begin(), itEnd = 
aEntries.end();
 for (; it != itEnd; ++it)
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-03-23 Thread Kohei Yoshida
 sc/inc/dpgroup.hxx  |4 ---
 sc/source/core/data/dpgroup.cxx |   50 +---
 2 files changed, 27 insertions(+), 27 deletions(-)

New commits:
commit 7a1401e953e10194a7d693e590dc4e6c34a37ec4
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Mar 23 23:49:43 2012 -0400

More on avoiding use of date helper.

diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx
index eb46685..fadb830 100644
--- a/sc/inc/dpgroup.hxx
+++ b/sc/inc/dpgroup.hxx
@@ -112,8 +112,6 @@ public:
 const ScDPGroupItem* GetGroupForName( const ScDPItemData rName ) const;  
// rName = entry in group dim.
 const ScDPGroupItem* GetGroupByIndex( size_t nIndex ) const;
 
-const ScDPDateGroupHelper* GetDateHelper() const{ return pDateHelper; }
-
 voidMakeDateHelper( const ScDPNumGroupInfo rInfo, sal_Int32 nPart 
);
 
 voidDisposeData();
@@ -141,8 +139,6 @@ public:
 
 const ScDPNumGroupInfo GetInfo() const { return aGroupInfo; }
 
-const ScDPDateGroupHelper* GetDateHelper() const{ return pDateHelper; }
-
 const std::vectorSCROW GetNumEntries(SCCOL nSourceDim, const ScDPCache* 
pCache) const;
 
 void MakeDateHelper( const ScDPNumGroupInfo rInfo, long nDim, sal_Int32 
nPart );
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index 872ddfc..5f8865c 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -722,6 +722,7 @@ void 
ScDPGroupTableData::ModifyFilterCriteria(vectorScDPCacheTable::Criterion
 
 // Go through all the filtered field names and process them appropriately.
 
+const ScDPCache* pCache = GetCacheTable().getCache();
 vectorScDPCacheTable::Criterion::const_iterator itrEnd = rCriteria.end();
 GroupFieldMapType::const_iterator itrGrpEnd = aGroupFieldIds.end();
 for (vectorScDPCacheTable::Criterion::const_iterator itr = 
rCriteria.begin(); itr != itrEnd; ++itr)
@@ -740,20 +741,23 @@ void 
ScDPGroupTableData::ModifyFilterCriteria(vectorScDPCacheTable::Criterion
 ScDPCacheTable::Criterion aCri;
 aCri.mnFieldIndex = itr-mnFieldIndex;
 const ScDPNumGroupDimension rNumGrpDim = 
pNumGroups[itr-mnFieldIndex];
-const ScDPDateGroupHelper* pDateHelper = 
rNumGrpDim.GetDateHelper();
+const ScDPNumGroupInfo* pNumInfo = 
pCache-GetNumGroupInfo(itr-mnFieldIndex);
 
-if (pDateHelper)
-{
-// grouped by dates.
-aCri.mpFilter.reset(
-new ScDPGroupDateFilter(
-pFilter-getMatchValue(), 
*pDoc-GetFormatTable()-GetNullDate(), pDateHelper-GetNumInfo()));
-}
-else
+if (pNumInfo)
 {
-// This dimension is grouped by numeric ranges.
-aCri.mpFilter.reset(
-new ScDPGroupNumFilter(pFilter-getMatchValue(), 
rNumGrpDim.GetInfo()));
+if (rNumGrpDim.IsDateDimension())
+{
+// grouped by dates.
+aCri.mpFilter.reset(
+new ScDPGroupDateFilter(
+pFilter-getMatchValue(), 
*pDoc-GetFormatTable()-GetNullDate(), *pNumInfo));
+}
+else
+{
+// This dimension is grouped by numeric ranges.
+aCri.mpFilter.reset(
+new ScDPGroupNumFilter(pFilter-getMatchValue(), 
*pNumInfo));
+}
 }
 
 aNewCriteria.push_back(aCri);
@@ -770,16 +774,17 @@ void 
ScDPGroupTableData::ModifyFilterCriteria(vectorScDPCacheTable::Criterion
 
 const ScDPGroupDimension* pGrpDim = itrGrp-second;
 long nSrcDim = pGrpDim-GetSourceDim();
-const ScDPDateGroupHelper* pDateHelper = pGrpDim-GetDateHelper();
+long nGrpDim = pGrpDim-GetGroupDim();
+const ScDPNumGroupInfo* pNumInfo = 
pCache-GetNumGroupInfo(nGrpDim);
 
-if (pDateHelper)
+if (pGrpDim-IsDateDimension()  pNumInfo)
 {
 // external number group
 ScDPCacheTable::Criterion aCri;
 aCri.mnFieldIndex = nSrcDim;  // use the source dimension, not 
the group dimension.
 aCri.mpFilter.reset(
 new ScDPGroupDateFilter(
-pFilter-getMatchValue(), 
*pDoc-GetFormatTable()-GetNullDate(), pDateHelper-GetNumInfo()));
+pFilter-getMatchValue(), 
*pDoc-GetFormatTable()-GetNullDate(), *pNumInfo));
 
 aNewCriteria.push_back(aCri);
 }
@@ -960,14 +965,14 @@ sal_Bool ScDPGroupTableData::IsNumOrDateGroup(long 
nDimension) const
 if ( nDimension  nSourceCount )
 {
 return 

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

2012-03-23 Thread Kohei Yoshida
 sc/inc/dpgroup.hxx |   33 +---
 sc/source/core/data/dpdimsave.cxx  |4 -
 sc/source/core/data/dpgroup.cxx|   99 ++---
 sc/source/filter/excel/xepivot.cxx |2 
 4 files changed, 25 insertions(+), 113 deletions(-)

New commits:
commit 16bbecab811a7ea95439bcbdf99050f766d18a9d
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Sat Mar 24 00:13:30 2012 -0400

ScDPDateGroupHelper class is no more.

diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx
index fadb830..fe5fd62 100644
--- a/sc/inc/dpgroup.hxx
+++ b/sc/inc/dpgroup.hxx
@@ -41,28 +41,6 @@
 class ScDocument;
 class SvNumberFormatter;
 
-//  ScDPDateGroupHelper is used as part of ScDPGroupDimension (additional dim.)
-//  or ScDPNumGroupDimension (innermost, replaces the original dim.).
-//  Source index, name and result collection are stored at the parent.
-
-class ScDPDateGroupHelper
-{
-ScDPNumGroupInfoaNumInfo;   // only start and end (incl. auto 
flags) are used
-sal_Int32   nDatePart;  // single part
-longmnGroupDim;
-
-public:
-ScDPDateGroupHelper( const ScDPNumGroupInfo rInfo, long nDim, 
sal_Int32 nPart );
-~ScDPDateGroupHelper();
-
-void SetGroupDim(long nDim);
-
-sal_Int32   GetDatePart() const { return nDatePart; }
-const ScDPNumGroupInfo GetNumInfo() const { return aNumInfo; }
-
-void FillColumnEntries(const ScDPCache* pCache, std::vectorSCROW 
rEntries) const;
-};
-
 typedef ::std::vectorScDPItemData ScDPItemDataVec;
 
 class ScDPGroupItem
@@ -90,9 +68,9 @@ class ScDPGroupDimension
 longnSourceDim;
 longnGroupDim;
 rtl::OUString   aGroupName;
-ScDPDateGroupHelper*pDateHelper;
 ScDPGroupItemVecaItems;
-   mutable  ::std::vector SCROW maMemberEntries;
+mutable std::vectorSCROW maMemberEntries;
+bool mbDateDimension;
 public:
 ScDPGroupDimension( long nSource, const String rNewName );
 ScDPGroupDimension( const ScDPGroupDimension rOther );
@@ -112,12 +90,11 @@ public:
 const ScDPGroupItem* GetGroupForName( const ScDPItemData rName ) const;  
// rName = entry in group dim.
 const ScDPGroupItem* GetGroupByIndex( size_t nIndex ) const;
 
-voidMakeDateHelper( const ScDPNumGroupInfo rInfo, sal_Int32 nPart 
);
-
 voidDisposeData();
 
 size_t  GetItemCount() const { return aItems.size(); }
 
+void SetDateDimension();
 bool IsDateDimension() const;
 };
 
@@ -126,8 +103,8 @@ typedef ::std::vectorScDPGroupDimension 
ScDPGroupDimensionVec;
 class SC_DLLPUBLIC ScDPNumGroupDimension
 {
 mutable ScDPNumGroupInfoaGroupInfo; // settings
-ScDPDateGroupHelper*pDateHelper;
 mutable std::vectorSCROW  maMemberEntries;
+bool mbDateDimension;
 
 public:
 ScDPNumGroupDimension();
@@ -141,7 +118,7 @@ public:
 
 const std::vectorSCROW GetNumEntries(SCCOL nSourceDim, const ScDPCache* 
pCache) const;
 
-void MakeDateHelper( const ScDPNumGroupInfo rInfo, long nDim, sal_Int32 
nPart );
+void SetDateDimension();
 
 voidDisposeData();
 
diff --git a/sc/source/core/data/dpdimsave.cxx 
b/sc/source/core/data/dpdimsave.cxx
index 30ddd74..80257be 100644
--- a/sc/source/core/data/dpdimsave.cxx
+++ b/sc/source/core/data/dpdimsave.cxx
@@ -379,7 +379,7 @@ void ScDPSaveGroupDimension::AddToData( ScDPGroupTableData 
rData ) const
 {
 // date grouping
 
-aDim.MakeDateHelper( aDateInfo, nDatePart );
+aDim.SetDateDimension();
 }
 else
 {
@@ -459,7 +459,7 @@ void ScDPSaveNumGroupDimension::AddToData( 
ScDPGroupTableData rData ) const
 {
 ScDPNumGroupDimension aDim( aGroupInfo );   // aGroupInfo: 
value grouping
 if ( nDatePart )
-aDim.MakeDateHelper( aDateInfo, nSource, nDatePart );// date 
grouping
+aDim.SetDateDimension();
 
 rData.SetNumGroupDimension( nSource, aDim );
 }
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index 5f8865c..a129fec 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -240,19 +240,6 @@ bool ScDPGroupDateFilter::match( const ScDPItemData  
rCellData ) const
 
 return false;
 }
-// ---
-
-ScDPDateGroupHelper::ScDPDateGroupHelper(
-const ScDPNumGroupInfo rInfo, long nDim, sal_Int32 nPart ) :
-aNumInfo( rInfo ),
-nDatePart( nPart ),
-mnGroupDim(nDim)
-{
-}
-
-ScDPDateGroupHelper::~ScDPDateGroupHelper()
-{
-}
 
 namespace {
 
@@ -304,18 +291,6 @@ bool isDateInGroup(const ScDPItemData rGroupItem, const 
ScDPItemData rChildIte
 
 }
 
-void ScDPDateGroupHelper::SetGroupDim(long nDim)
-{
-mnGroupDim = nDim;
-}
-
-void 

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

2012-03-16 Thread Kohei Yoshida
 sc/inc/dpcache.hxx |5 +++
 sc/inc/dpitemdata.hxx  |   10 +--
 sc/source/core/data/dpcache.cxx|   28 --
 sc/source/core/data/dpitemdata.cxx |   47 ++---
 4 files changed, 72 insertions(+), 18 deletions(-)

New commits:
commit f81d15c3bab32938b5b475e16ae2a746a7a32ea9
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Mar 16 21:44:55 2012 -0400

Use shared string pool to share string instances among string item values.

This brings down the reload time from 22 seconds to 4.3 seconds with
my test document.  This is what I've been looking for!

diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 839f64b..2591b3d 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -36,6 +36,7 @@
 #include boost/noncopyable.hpp
 #include boost/scoped_ptr.hpp
 #include boost/ptr_container/ptr_vector.hpp
+#include boost/unordered_set.hpp
 #include mdds/flat_segment_tree.hpp
 
 #include vector
@@ -58,6 +59,8 @@ struct ScDPNumGroupInfo;
  */
 class SC_DLLPUBLIC ScDPCache : boost::noncopyable
 {
+typedef boost::unordered_setrtl::OUString, rtl::OUStringHash 
StringSetType;
+
 public:
 typedef std::vectorScDPItemData ItemsType;
 typedef std::setScDPObject* ObjectSetType;
@@ -112,6 +115,7 @@ private:
 
 FieldsType maFields;
 GroupFieldsType maGroupFields;
+mutable StringSetType maStringPool;
 
 LabelsType maLabelNames;// Stores dimension names.
 mdds::flat_segment_treeSCROW, bool maEmptyRows;
@@ -119,6 +123,7 @@ private:
 bool mbDisposing;
 
 public:
+const rtl::OUString* InternString(const rtl::OUString rStr) const;
 void AddReference(ScDPObject* pObj) const;
 void RemoveReference(ScDPObject* pObj) const;
 const ObjectSetType GetAllReferences() const;
diff --git a/sc/inc/dpitemdata.hxx b/sc/inc/dpitemdata.hxx
index e30eae3..20535a8 100644
--- a/sc/inc/dpitemdata.hxx
+++ b/sc/inc/dpitemdata.hxx
@@ -49,7 +49,7 @@ class SC_DLLPUBLIC ScDPItemData
 friend class ScDPCache;
 
 public:
-enum Type { GroupValue = 0, RangeStart, Value, String, Error, Empty };
+enum Type { GroupValue = 0, RangeStart = 1, Value = 2, String = 3, Error = 
4, Empty = 5 };
 
 static const sal_Int32 DateFirst;
 static const sal_Int32 DateLast;
@@ -63,12 +63,13 @@ public:
 private:
 
 union {
-rtl::OUString* mpString;
+const rtl::OUString* mpString;
 GroupValueAttr maGroupValue;
 double mfValue;
 };
 
-Type meType;
+sal_uInt8 meType:3;
+bool mbStringInterned:1;
 
 void DisposeString();
 
@@ -79,16 +80,19 @@ public:
 ScDPItemData();
 ScDPItemData(const ScDPItemData r);
 ScDPItemData(const rtl::OUString rStr);
+ScDPItemData(const rtl::OUString* pStr);
 ScDPItemData(sal_Int32 nGroupType, sal_Int32 nValue);
 ~ScDPItemData();
 
 Type GetType() const;
 void SetString(const rtl::OUString rS);
+void SetString(const rtl::OUString* pS);
 void SetValue(double fVal);
 void SetRangeStart(double fVal);
 void SetRangeFirst();
 void SetRangeLast();
 void SetErrorString(const rtl::OUString rS);
+void SetErrorString(const rtl::OUString* pS);
 bool IsCaseInsEqual(const ScDPItemData r) const;
 
 // exact equality
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 216c2ff..369c5b3 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -138,7 +138,9 @@ rtl::OUString createLabelString(ScDocument* pDoc, SCCOL 
nCol, SCROW nRow, SCTAB
 return aDocStr;
 }
 
-void initFromCell(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, 
ScDPItemData rData, sal_uLong rNumFormat)
+void initFromCell(
+ScDPCache rCache, ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
+ScDPItemData rData, sal_uLong rNumFormat)
 {
 rtl::OUString aDocStr = pDoc-GetString(nCol, nRow, nTab);
 rNumFormat = 0;
@@ -147,7 +149,7 @@ void initFromCell(ScDocument* pDoc, SCCOL nCol, SCROW nRow, 
SCTAB nTab, ScDPItem
 
 if (pDoc-GetErrCode(aPos))
 {
-rData.SetErrorString(aDocStr);
+rData.SetErrorString(rCache.InternString(aDocStr));
 }
 else if (pDoc-HasValueData(nCol, nRow, nTab))
 {
@@ -157,12 +159,12 @@ void initFromCell(ScDocument* pDoc, SCCOL nCol, SCROW 
nRow, SCTAB nTab, ScDPItem
 }
 else if (pDoc-HasData(nCol, nRow, nTab))
 {
-rData.SetString(aDocStr);
+rData.SetString(rCache.InternString(aDocStr));
 }
 }
 
 void getItemValue(
-ScDPItemData rData, const Referencesdbc::XRow xRow, sal_Int32 nType,
+ScDPCache rCache, ScDPItemData rData, const Referencesdbc::XRow xRow, 
sal_Int32 nType,
 long nCol, const Date rNullDate, short rNumType)
 {
 rNumType = NUMBERFORMAT_NUMBER;
@@ -232,7 +234,7 @@ void getItemValue(
 case sdbc::DataType::VARBINARY:
 case sdbc::DataType::LONGVARBINARY:
 default:
-  

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

2012-03-14 Thread Kohei Yoshida
 sc/inc/dapiuno.hxx  |1 +
 sc/source/ui/unoobj/dapiuno.cxx |   24 ++--
 2 files changed, 15 insertions(+), 10 deletions(-)

New commits:
commit f697d7aa5c26f9fcfd717b76a4827a5bcb38325e
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Wed Mar 14 20:40:38 2012 -0400

Fix the UNO API for creating a new group dimension.

diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx
index fd3ec8d..98bdca0 100644
--- a/sc/inc/dapiuno.hxx
+++ b/sc/inc/dapiuno.hxx
@@ -422,6 +422,7 @@ protected:
 ::com::sun::star::uno::Reference ::com::sun::star::container::XNameAccess 

 GetMembers() const;
 
+ScDocShell* GetDocShell() const;
 protected:
 ScDataPilotDescriptorBase mrParent;
 ScFieldIdentifier   maFieldId;
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index d1d7d96..45a88e7 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1193,7 +1193,7 @@ void ScDataPilotTableObj::SetDPObject( ScDPObject* 
pDPObject )
 if ( pDPObj  pDocSh )
 {
 ScDBDocFunc aFunc(*pDocSh);
-aFunc.DataPilotUpdate( pDPObj, pDPObject, sal_True, sal_True );
+aFunc.DataPilotUpdate( pDPObj, pDPObject, true, true );
 }
 }
 
@@ -1565,6 +1565,11 @@ Reference XNameAccess  
ScDataPilotChildObjBase::GetMembers() const
 return xMembersNA;
 }
 
+ScDocShell* ScDataPilotChildObjBase::GetDocShell() const
+{
+return mrParent.GetDocShell();
+}
+
 // 
 
 ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase rParent 
) :
@@ -2569,13 +2574,13 @@ Reference XDataPilotField  SAL_CALL 
ScDataPilotFieldObj::createNameGroup( cons
 ScDPObject* pDPObj = 0;
 if( ScDPSaveDimension* pDim = GetDPDimension( pDPObj ) )
 {
-String aDimName = pDim-GetName();
+rtl::OUString aDimName = pDim-GetName();
 
 ScDPSaveData aSaveData = *pDPObj-GetSaveData();
 ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData(); // 
created if not there
 
 // find original base
-String aBaseDimName( aDimName );
+rtl::OUString aBaseDimName( aDimName );
 const ScDPSaveGroupDimension* pBaseGroupDim = 
pDimData-GetNamedGroupDim( aDimName );
 if ( pBaseGroupDim )
 {
@@ -2595,7 +2600,7 @@ Reference XDataPilotField  SAL_CALL 
ScDataPilotFieldObj::createNameGroup( cons
 {
 for (nEntry=0; nEntrynEntryCount; nEntry++)
 {
-String aEntryName(rItems[nEntry]);
+const rtl::OUString aEntryName = rItems[nEntry];
 if ( pBaseGroupDim )
 {
 // for each selected (intermediate) group, remove all its 
items
@@ -2615,9 +2620,8 @@ Reference XDataPilotField  SAL_CALL 
ScDataPilotFieldObj::createNameGroup( cons
 if ( !pGroupDimension )
 {
 // create a new group dimension
-String aGroupDimName = pDimData-CreateGroupDimName( aBaseDimName, 
*pDPObj, false, NULL );
-pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, 
aGroupDimName );
-sNewDim = aGroupDimName;
+sNewDim = pDimData-CreateGroupDimName( aBaseDimName, *pDPObj, 
false, NULL );
+pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, sNewDim );
 
 pGroupDimension = pNewGroupDim; // make changes to the new dim 
if none existed
 
@@ -2645,10 +2649,10 @@ Reference XDataPilotField  SAL_CALL 
ScDataPilotFieldObj::createNameGroup( cons
 }
 }
 }
-String aGroupDimName = pGroupDimension-GetGroupDimName();
+rtl::OUString aGroupDimName = pGroupDimension-GetGroupDimName();
 
 //! localized prefix string
-String aGroupName = pGroupDimension-CreateGroupName( String( 
RTL_CONSTASCII_USTRINGPARAM( Group ) ) );
+rtl::OUString aGroupName = pGroupDimension-CreateGroupName( String( 
RTL_CONSTASCII_USTRINGPARAM( Group ) ) );
 ScDPSaveGroupItem aGroup( aGroupName );
 Reference XNameAccess  xMembers = GetMembers();
 if (!xMembers.is())
@@ -2702,7 +2706,7 @@ Reference XDataPilotField  SAL_CALL 
ScDataPilotFieldObj::createNameGroup( cons
 
 // apply changes
 pDPObj-SetSaveData( aSaveData );
-SetDPObject( pDPObj );
+ScDBDocFunc(*GetDocShell()).RefreshPivotTableGroups(pDPObj);
 }
 
 // if new grouping field has been created (on first group), return it
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-03-12 Thread Kohei Yoshida
 sc/inc/dpcachetable.hxx  |   21 +++-
 sc/source/core/data/dpcachetable.cxx |   67 +++--
 sc/source/core/data/dpgroup.cxx  |   91 ---
 sc/source/core/data/dptabres.cxx |2 
 sc/source/core/data/dptabsrc.cxx |7 +-
 5 files changed, 76 insertions(+), 112 deletions(-)

New commits:
commit 85f580ac0c0ed73ee24cf88be7866015c903b2eb
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Mon Mar 12 15:46:10 2012 -0400

Get double-click drill-down of pivot data to work again.

diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index 00e9db2..47114e0 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -32,6 +32,7 @@
 #include sal/types.h
 #include osl/mutex.hxx
 #include global.hxx
+#include dpitemdata.hxx
 
 #include vector
 #include boost/unordered_set.hpp
@@ -68,12 +69,10 @@ public:
 /** individual filter item used in SingleFilter and GroupFilter. */
 struct FilterItem
 {
-rtl::OUString maString;
-double  mfValue;
-boolmbHasValue;
+ScDPItemData maItem;
 
 FilterItem();
-bool match( const  ScDPItemData rCellData ) const;
+bool match(const ScDPItemData rCellData) const;
 };
 
 /** interface class used for filtering of rows. */
@@ -90,19 +89,17 @@ public:
 class SingleFilter : public FilterBase
 {
 public:
-explicit SingleFilter(const rtl::OUString aString, double fValue, 
bool bHasValue);
+explicit SingleFilter(const ScDPItemData rItem);
 virtual ~SingleFilter() {}
 
 virtual bool match(const ScDPItemData rCellData) const;
 
-const rtl::OUString getMatchString() const;
-double  getMatchValue() const;
-boolhasValue() const;
+const ScDPItemData getMatchValue() const;
 
 private:
 explicit SingleFilter();
 
-FilterItem  maItem;
+ScDPItemData maItem;
 };
 
 /** multi-item (group) filter. */
@@ -111,12 +108,12 @@ public:
 public:
 GroupFilter();
 virtual ~GroupFilter() {}
-virtual bool match(  const  ScDPItemData rCellData ) const;
-void addMatchItem(const rtl::OUString rStr, double fVal, bool 
bHasValue);
+virtual bool match(const ScDPItemData rCellData) const;
+void addMatchItem(const ScDPItemData rItem);
 size_t getMatchItemCount() const;
 
 private:
-::std::vectorFilterItem maItems;
+::std::vectorScDPItemData maItems;
 };
 
 /** single filtering criterion. */
diff --git a/sc/source/core/data/dpcachetable.cxx 
b/sc/source/core/data/dpcachetable.cxx
index d751e39..ff0335e 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -84,74 +84,47 @@ ScDPCacheTable::RowFlag::RowFlag() :
 {
 }
 
-ScDPCacheTable::FilterItem::FilterItem() :
-mfValue(0.0),
-mbHasValue(false)
-{
-}
+ScDPCacheTable::FilterItem::FilterItem() {}
 
-bool ScDPCacheTable::FilterItem::match( const  ScDPItemData rCellData ) const
+bool ScDPCacheTable::FilterItem::match(const ScDPItemData rCellData) const
 {
-if (!rCellData.GetString().equals(maString) 
-(!rCellData.IsValue()|| rCellData.GetValue()!=  mfValue))
-return false;
-return true;
+return rCellData == maItem;
 }
 
 // 
 
-ScDPCacheTable::SingleFilter::SingleFilter(const rtl::OUString aString, 
double fValue, bool bHasValue)
-{
-maItem.maString = aString;
-maItem.mfValue  = fValue;
-maItem.mbHasValue   = bHasValue;
-}
-
-bool ScDPCacheTable::SingleFilter::match( const  ScDPItemData rCellData ) 
const
-{
-  return maItem.match(rCellData);
-}
+ScDPCacheTable::SingleFilter::SingleFilter(const ScDPItemData rItem) :
+maItem(rItem) {}
 
-const rtl::OUString ScDPCacheTable::SingleFilter::getMatchString() const
+bool ScDPCacheTable::SingleFilter::match(const ScDPItemData rCellData) const
 {
-return maItem.maString;
+return maItem == rCellData;
 }
 
-double ScDPCacheTable::SingleFilter::getMatchValue() const
+const ScDPItemData ScDPCacheTable::SingleFilter::getMatchValue() const
 {
-return maItem.mfValue;
+return maItem;
 }
 
-bool ScDPCacheTable::SingleFilter::hasValue() const
-{
-return maItem.mbHasValue;
-}
-
-// 
-
 ScDPCacheTable::GroupFilter::GroupFilter()
 {
 }
 
-bool ScDPCacheTable::GroupFilter::match( const  ScDPItemData rCellData ) const
+bool ScDPCacheTable::GroupFilter::match(const ScDPItemData rCellData) const
 {
-vectorFilterItem::const_iterator itrEnd = maItems.end();
-for (vectorFilterItem::const_iterator itr = maItems.begin(); itr != 
itrEnd; ++itr)
-{
-bool bMatch = itr-match( rCellData);
-if (bMatch)
-return  true;
-}
-

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

2012-03-09 Thread Stephan Bergmann
 sc/inc/dpgroup.hxx   |2 +-
 sc/inc/dptablecache.hxx  |2 +-
 sc/source/core/data/dpgroup.cxx  |7 ++-
 sc/source/core/data/dptablecache.cxx |   10 ++
 4 files changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 59e4ac4c3e55562856cdab04435489f9dc67d318
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Mar 9 18:22:00 2012 +0100

-Werror={deprecated-declarations,sign-compare,unused-parameter}

diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx
index 5340b70..be7d39c 100644
--- a/sc/inc/dpgroup.hxx
+++ b/sc/inc/dpgroup.hxx
@@ -107,7 +107,7 @@ public:
 longGetGroupDim() const { return nGroupDim; }
 const  String GetName() const   { return aGroupName; }
 
-const std::vector SCROW   GetColumnEntries( const ScDPCacheTable  
rCacheTable, const std::vector SCROW  rOriginal ) const;
+const std::vector SCROW   GetColumnEntries( const ScDPCacheTable  
rCacheTable ) const;
 const ScDPGroupItem* GetGroupForData( const ScDPItemData rData ) const;  
// rData = entry in original dim.
 const ScDPGroupItem* GetGroupForName( const ScDPItemData rName ) const;  
// rName = entry in group dim.
 const ScDPGroupItem* GetGroupByIndex( size_t nIndex ) const;
diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx
index 62af398..661c5cd 100644
--- a/sc/inc/dptablecache.hxx
+++ b/sc/inc/dptablecache.hxx
@@ -149,7 +149,7 @@ public:
 
 SCROW  GetRowCount() const;
 SCROW  GetItemDataId( sal_uInt16 nDim, SCROW nRow, bool bRepeatIfEmpty ) 
const;
-rtl::OUString GetDimensionName(long nDim) const;
+rtl::OUString GetDimensionName(LabelsType::size_type nDim) const;
 bool IsRowEmpty( SCROW nRow ) const;
 bool IsValid() const;
 bool ValidQuery(SCROW nRow, const ScQueryParam rQueryParam) const;
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index a2eb282..98816b0 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -450,7 +450,7 @@ void ScDPGroupDimension::SetGroupDim( long nDim )
 }
 
 const std::vectorSCROW ScDPGroupDimension::GetColumnEntries(
-const ScDPCacheTable rCacheTable, const std::vectorSCROW rOriginal) 
const
+const ScDPCacheTable rCacheTable) const
 {
 if (!maMemberEntries.empty())
 return maMemberEntries;
@@ -635,10 +635,7 @@ const std::vector SCROW  
ScDPGroupTableData::GetColumnEntries( long  nColumn
 else
 {
 const ScDPGroupDimension rGroupDim = aGroups[nColumn - 
nSourceCount];
-long nSourceDim = rGroupDim.GetSourceDim();
-// collection is cached at pSourceData, GetColumnEntries can be 
called every time
-const  std::vector SCROW  rOriginal = 
pSourceData-GetColumnEntries( nSourceDim );
-return rGroupDim.GetColumnEntries( GetCacheTable(), rOriginal );
+return rGroupDim.GetColumnEntries( GetCacheTable() );
 }
 }
 
diff --git a/sc/source/core/data/dptablecache.cxx 
b/sc/source/core/data/dptablecache.cxx
index ff12648..c01e132 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -626,7 +626,9 @@ bool ScDPCache::AddData(long nDim, ScDPItemData* pData, 
sal_uLong nNumFormat)
 OSL_ENSURE( nDim  mnColumnCount  nDim =0 , dimension out of bound );
 
 // Wrap this instance with scoped pointer to ensure proper deletion.
+SAL_WNODEPRECATED_DECLARATIONS_PUSH
 auto_ptrScDPItemData p(pData);
+SAL_WNODEPRECATED_DECLARATIONS_POP
 
 SCROW nIndex = 0;
 Field rField = maFields[nDim];
@@ -636,7 +638,7 @@ bool ScDPCache::AddData(long nDim, ScDPItemData* pData, 
sal_uLong nNumFormat)
 rField.maItems.push_back(p);
 rField.maGlobalOrder.insert(
 rField.maGlobalOrder.begin()+nIndex, rField.maItems.size()-1);
-OSL_ENSURE(rField.maGlobalOrder[nIndex] == rField.maItems.size()-1, 
ScDPTableDataCache::AddData );
+OSL_ENSURE(rField.maGlobalOrder[nIndex] == 
sal::static_int_castSCROW(rField.maItems.size())-1, 
ScDPTableDataCache::AddData );
 rField.maData.push_back(rField.maItems.size()-1);
 rField.maNumFormats.push_back(nNumFormat);
 }
@@ -671,12 +673,12 @@ const ScDPCache::GroupItems* 
ScDPCache::GetGroupItems(long nDim) const
 return NULL;
 }
 
-rtl::OUString ScDPCache::GetDimensionName(long nDim) const
+rtl::OUString ScDPCache::GetDimensionName(LabelsType::size_type nDim) const
 {
 OSL_ENSURE(nDim  maLabelNames.size()-1 , 
ScDPTableDataCache::GetDimensionName);
 OSL_ENSURE(maLabelNames.size() == static_cast sal_uInt16 
(mnColumnCount+1), ScDPTableDataCache::GetDimensionName);
 
-if ( static_castsize_t(nDim+1)  maLabelNames.size() )
+if ( nDim+1  maLabelNames.size() )
 {
 return maLabelNames[nDim+1];
 }
@@ -1099,7 +1101,7 @@ SCROW ScDPCache::GetOrder(long nDim, SCROW nIndex) const
 }
 }
 
-OSL_ENSURE(nIndex = 0  nIndex  

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

2012-03-09 Thread Kohei Yoshida
 sc/inc/dpcache.hxx  |5 +-
 sc/source/core/data/dpcache.cxx |   91 +---
 2 files changed, 51 insertions(+), 45 deletions(-)

New commits:
commit 8d089c8e293a3366d9c0ac67cbfdf2a6deff5d98
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Mar 9 17:46:48 2012 -0500

Use std::vector instead of boost::ptr_vector for ScDPItemData.

It's a small-size object, so using std::vector is slightly more
efficient.

diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 2880c5a..4c5e1bf 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -57,7 +57,7 @@ struct ScDPNumGroupInfo;
 class SC_DLLPUBLIC ScDPCache : boost::noncopyable
 {
 public:
-typedef boost::ptr_vectorScDPItemData DataListType;
+typedef std::vectorScDPItemData DataListType;
 typedef std::setScDPObject* ObjectSetType;
 typedef std::vectorrtl::OUString LabelsType;
 typedef std::vectorSCROW IndexArrayType;
@@ -166,9 +166,10 @@ public:
 ~ScDPCache();
 
 private:
+void PostInit();
 void Clear();
 void AddLabel(const rtl::OUString rLabel);
-bool AddData(long nDim, ScDPItemData* pData, sal_uLong nNumFormat);
+bool AddData(long nDim, const ScDPItemData rData, sal_uLong nNumFormat);
 const GroupItems* GetGroupItems(long nDim) const;
 };
 
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 73e1819..09bce92 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -60,8 +60,6 @@ using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::std::vector;
-using ::std::auto_ptr;
 
 namespace {
 
@@ -76,7 +74,7 @@ namespace {
  *
  * @return true if the item is found, or false otherwise.
  */
-bool hasItemInDimension(const ScDPCache::DataListType rArray, const 
ScDPCache::IndexArrayType rOrder, const ScDPItemData item, SCROW rIndex)
+bool hasItemInDimension(const ScDPCache::DataListType rArray, const 
ScDPCache::IndexArrayType rOrder, const ScDPItemData rItem, SCROW rIndex)
 {
 rIndex = rArray.size();
 bool bFound = false;
@@ -86,7 +84,7 @@ bool hasItemInDimension(const ScDPCache::DataListType 
rArray, const ScDPCache::
 while (nLo = nHi)
 {
 SCROW nIndex = (nLo + nHi) / 2;
-nCompare = ScDPItemData::Compare( rArray[rOrder[nIndex]], item );
+nCompare = ScDPItemData::Compare(rArray[rOrder[nIndex]], rItem);
 if (nCompare  0)
 nLo = nIndex + 1;
 else
@@ -103,8 +101,9 @@ bool hasItemInDimension(const ScDPCache::DataListType 
rArray, const ScDPCache::
 return bFound;
 }
 
-ScDPItemData* lcl_GetItemValue(
-const Referencesdbc::XRow xRow, sal_Int32 nType, long nCol, const Date 
rNullDate, short rNumType)
+void getItemValue(
+ScDPItemData rData, const Referencesdbc::XRow xRow, sal_Int32 nType,
+long nCol, const Date rNullDate, short rNumType)
 {
 rNumType = NUMBERFORMAT_NUMBER;
 try
@@ -117,7 +116,8 @@ ScDPItemData* lcl_GetItemValue(
 {
 rNumType = NUMBERFORMAT_LOGICAL;
 fValue  = xRow-getBoolean(nCol) ? 1 : 0;
-return new ScDPItemData(fValue);
+rData.SetValue(fValue);
+break;
 }
 case sdbc::DataType::TINYINT:
 case sdbc::DataType::SMALLINT:
@@ -131,7 +131,8 @@ ScDPItemData* lcl_GetItemValue(
 {
 //! do the conversion here?
 fValue = xRow-getDouble(nCol);
-return new ScDPItemData(fValue);
+rData.SetValue(fValue);
+break;
 }
 case sdbc::DataType::DATE:
 {
@@ -139,7 +140,8 @@ ScDPItemData* lcl_GetItemValue(
 
 util::Date aDate = xRow-getDate(nCol);
 fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate;
-return new ScDPItemData(fValue);
+rData.SetValue(fValue);
+break;
 }
 case sdbc::DataType::TIME:
 {
@@ -148,7 +150,8 @@ ScDPItemData* lcl_GetItemValue(
 util::Time aTime = xRow-getTime(nCol);
 fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / 
D_TIMEFACTOR;
-return new ScDPItemData(fValue);
+rData.SetValue(fValue);
+break;
 }
 case sdbc::DataType::TIMESTAMP:
 {
@@ -158,7 +161,8 @@ ScDPItemData* lcl_GetItemValue(
 fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - 
rNullDate ) +
  ( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) 
/ D_TIMEFACTOR;
-return new ScDPItemData(fValue);
+

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

2012-03-09 Thread Kohei Yoshida
 sc/inc/dpcache.hxx   |   14 --
 sc/inc/dptabdat.hxx  |1 +
 sc/source/core/data/dpcache.cxx  |5 +++--
 sc/source/core/data/dpobject.cxx |1 +
 4 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit 3a30ced6bea3567bce2cc79adc6beb28f18b554b
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Mar 9 20:06:45 2012 -0500

Some header cleanup.

diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 4c5e1bf..a0e6a6d 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -31,12 +31,7 @@
 
 #include global.hxx
 #include dpnumgroupinfo.hxx
-
-#include svl/zforlist.hxx
-
-#include com/sun/star/sdbc/DataType.hpp
-#include com/sun/star/sdbc/XRow.hpp
-#include com/sun/star/sdbc/XRowSet.hpp
+#include tools/date.hxx
 
 #include boost/noncopyable.hpp
 #include boost/scoped_ptr.hpp
@@ -44,6 +39,13 @@
 #include mdds/flat_segment_tree.hpp
 
 #include vector
+#include set
+
+namespace com { namespace sun { namespace star {
+namespace sdbc {
+class XRowSet;
+}
+}}}
 
 struct ScQueryParam;
 class ScDPObject;
diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx
index 0fbad22..3951275 100644
--- a/sc/inc/dptabdat.hxx
+++ b/sc/inc/dptabdat.hxx
@@ -34,6 +34,7 @@
 #include dpcachetable.hxx
 #include dpcache.hxx
 #include tools/string.hxx
+#include svl/zforlist.hxx
 
 #include vector
 #include set
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 09bce92..0aa8224 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -43,12 +43,13 @@
 #include rtl/math.hxx
 #include unotools/textsearch.hxx
 #include unotools/localedatawrapper.hxx
+#include svl/zforlist.hxx
 
 #include com/sun/star/sdbc/DataType.hpp
-#include com/sun/star/sdbc/XRow.hpp
-#include com/sun/star/sdbc/XRowSet.hpp
 #include com/sun/star/sdbc/XResultSetMetaData.hpp
 #include com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp
+#include com/sun/star/sdbc/XRow.hpp
+#include com/sun/star/sdbc/XRowSet.hpp
 
 #include memory
 
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 8e1eff8..3b192b5 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -56,6 +56,7 @@
 
 #include com/sun/star/beans/XPropertySet.hpp
 #include com/sun/star/sdb/XCompletedExecution.hpp
+#include com/sun/star/sdbc/XRowSet.hpp
 #include com/sun/star/sheet/GeneralFunction.hpp
 #include com/sun/star/sheet/DataPilotFieldFilter.hpp
 #include com/sun/star/sheet/DataPilotFieldOrientation.hpp
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-03-09 Thread Kohei Yoshida
 sc/inc/dpcache.hxx  |2 +-
 sc/source/core/data/dpcache.cxx |   18 ++
 2 files changed, 7 insertions(+), 13 deletions(-)

New commits:
commit 372cfda4d6a4d49bb45cea0dc45b23ffd9dd5b3d
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Mar 9 20:19:12 2012 -0500

Store only one number format per field.

diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index a0e6a6d..9f33db5 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -100,7 +100,7 @@ public:
  */
 mutable IndexArrayType maIndexOrder;
 
-std::vectorsal_uLong maNumFormats;
+sal_uLong mnNumFormat;
 
 Field();
 };
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 0aa8224..9ce9e25 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -226,7 +226,7 @@ bool ScDPCache::operator== ( const ScDPCache r ) const
 return true;
 }
 
-ScDPCache::Field::Field() {}
+ScDPCache::Field::Field() : mnNumFormat(0) {}
 
 ScDPCache::ScDPCache(ScDocument* pDoc) :
 mpDoc( pDoc ),
@@ -637,7 +637,6 @@ bool ScDPCache::AddData(long nDim, const ScDPItemData 
rData, sal_uLong nNumForm
 rField.maGlobalOrder.begin()+nIndex, rField.maItems.size()-1);
 OSL_ENSURE(rField.maGlobalOrder[nIndex] == 
sal::static_int_castSCROW(rField.maItems.size())-1, 
ScDPTableDataCache::AddData );
 rField.maData.push_back(rField.maItems.size()-1);
-rField.maNumFormats.push_back(nNumFormat);
 }
 else
 rField.maData.push_back(rField.maGlobalOrder[nIndex]);
@@ -645,7 +644,10 @@ bool ScDPCache::AddData(long nDim, const ScDPItemData 
rData, sal_uLong nNumForm
 size_t nCurRow = maFields[nDim].maData.size() - 1;
 
 if (!rData.IsEmpty())
+{
 maEmptyRows.insert_back(nCurRow, nCurRow+1, false);
+rField.mnNumFormat = nNumFormat;
+}
 
 return true;
 }
@@ -813,13 +815,9 @@ sal_uLong ScDPCache::GetNumberFormat( long nDim ) const
 if ( nDim = mnColumnCount )
 return 0;
 
-const std::vectorsal_uLong rNumFormats = maFields[nDim].maNumFormats;
-if (rNumFormats.empty())
-return 0;
-
 // TODO: Find a way to determine the dominant number format in presence of
 // multiple number formats in the same field.
-return *rNumFormats.begin();
+return maFields[nDim].mnNumFormat;
 }
 
 bool ScDPCache::IsDateDimension( long nDim ) const
@@ -831,11 +829,7 @@ bool ScDPCache::IsDateDimension( long nDim ) const
 if (!pFormatter)
 return false;
 
-const std::vectorsal_uLong rNumFormats = maFields[nDim].maNumFormats;
-if (rNumFormats.empty())
-return false;
-
-short eType = pFormatter-GetType(rNumFormats[0]);
+short eType = pFormatter-GetType(maFields[nDim].mnNumFormat);
 return (eType == NUMBERFORMAT_DATE) || (eType == NUMBERFORMAT_DATETIME);
 }
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-03-04 Thread Ivan Timofeev
 sc/inc/viewuno.hxx  |   63 +++
 sc/source/ui/unoobj/viewuno.cxx |  160 ++--
 2 files changed, 106 insertions(+), 117 deletions(-)

New commits:
commit 07342a6aac8c32823fde4be163bb9132ed17d537
Author: Noel Grandin n...@peralex.com
Date:   Wed Feb 29 13:11:18 2012 +0200

Convert usages of SV_DECL_PTRARR_DEL to boost::ptr_vector

* Make typedefs private to class ScTabViewObj
* rename field aSelectionListeners to aSelectionChgListeners

diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index 723cf89..cf867b7 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -51,38 +51,13 @@
 #include com/sun/star/datatransfer/XTransferableSupplier.hpp
 
 #include address.hxx
+#include boost/ptr_container/ptr_vector.hpp
 
 class ScTabViewShell;
 class ScPreviewShell;
 
 #define SC_VIEWPANE_ACTIVE  0x
 
-
-typedef ::com::sun::star::uno::Reference
-::com::sun::star::sheet::XRangeSelectionListener * 
XRangeSelectionListenerPtr;
-SV_DECL_PTRARR_DEL( XRangeSelectionListenerArr_Impl, 
XRangeSelectionListenerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference
-::com::sun::star::sheet::XRangeSelectionChangeListener * 
XRangeSelectionChangeListenerPtr;
-SV_DECL_PTRARR_DEL( XRangeSelectionChangeListenerArr_Impl, 
XRangeSelectionChangeListenerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference
-::com::sun::star::view::XSelectionChangeListener * 
XSelectionChangeListenerPtr;
-SV_DECL_PTRARR_DEL( XSelectionChangeListenerArr_Impl, 
XSelectionChangeListenerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference
-::com::sun::star::beans::XPropertyChangeListener * 
XViewPropertyChangeListenerPtr;
-SV_DECL_PTRARR_DEL( XViewPropertyChangeListenerArr_Impl, 
XViewPropertyChangeListenerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference
-::com::sun::star::awt::XEnhancedMouseClickHandler * 
XMouseClickHandlerPtr;
-SV_DECL_PTRARR_DEL( XMouseClickHandlerArr_Impl, XMouseClickHandlerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference
-::com::sun::star::sheet::XActivationEventListener * 
XActivationEventListenerPtr;
-SV_DECL_PTRARR_DEL( XActivationEventListenerArr_Impl, 
XActivationEventListenerPtr, 4 )
-
-
 //  ScViewPaneBase not derived from OWeakObject
 //  to avoid duplicate OWeakObject in ScTabViewObj
 
@@ -194,13 +169,37 @@ class ScTabViewObj : public ScViewPaneBase,
  public com::sun::star::sheet::XSelectedSheetsSupplier
 {
 private:
+typedef ::com::sun::star::uno::Reference
+::com::sun::star::sheet::XRangeSelectionListener  
XRangeSelectionListenerUnoRef;
+typedef boost::ptr_vectorXRangeSelectionListenerUnoRef 
XRangeSelectionListenerVector;
+
+typedef ::com::sun::star::uno::Reference
+::com::sun::star::sheet::XRangeSelectionChangeListener  
XRangeSelectionChangeListenerUnoRef;
+typedef boost::ptr_vectorXRangeSelectionChangeListenerUnoRef 
XRangeSelectionChangeListenerVector;
+
+typedef ::com::sun::star::uno::Reference
+::com::sun::star::view::XSelectionChangeListener  
XSelectionChangeListenerUnoRef;
+typedef boost::ptr_vectorXSelectionChangeListenerUnoRef 
XSelectionChangeListenerVector;
+
+typedef ::com::sun::star::uno::Reference
+::com::sun::star::beans::XPropertyChangeListener  
XViewPropertyChangeListenerUnoRef;
+typedef boost::ptr_vectorXViewPropertyChangeListenerUnoRef 
XViewPropertyChangeListenerVector;
+
+typedef ::com::sun::star::uno::Reference
+::com::sun::star::awt::XEnhancedMouseClickHandler  
XMouseClickHandlerUnoRef;
+typedef boost::ptr_vectorXMouseClickHandlerUnoRef 
XMouseClickHandlerVector;
+
+typedef ::com::sun::star::uno::Reference
+::com::sun::star::sheet::XActivationEventListener  
XActivationEventListenerUnoRef;
+typedef boost::ptr_vectorXActivationEventListenerUnoRef 
XActivationEventListenerVector;
+
 SfxItemPropertySet  aPropSet;
-XSelectionChangeListenerArr_ImplaSelectionListeners;
-XRangeSelectionListenerArr_Impl aRangeSelListeners;
-XRangeSelectionChangeListenerArr_Impl   aRangeChgListeners;
-XViewPropertyChangeListenerArr_Impl aPropertyChgListeners;
-XMouseClickHandlerArr_Impl  aMouseClickHandlers;
-XActivationEventListenerArr_ImplaActivationListeners;
+XSelectionChangeListenerVector  aSelectionChgListeners;
+XRangeSelectionListenerVector   aRangeSelListeners;
+XRangeSelectionChangeListenerVector aRangeChgListeners;
+XViewPropertyChangeListenerVector   aPropertyChgListeners;
+XMouseClickHandlerVectoraMouseClickHandlers;
+XActivationEventListenerVector  aActivationListeners;
 SCTAB   nPreviousTab;
 sal_BoolbDrawSelModeSet;
 sal_Bool

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

2012-02-13 Thread Michael Meeks
 sc/inc/chgtrack.hxx  |3 ---
 sc/source/core/tool/chgtrack.cxx |   15 ---
 sc/source/ui/inc/output.hxx  |1 -
 sc/source/ui/view/output2.cxx|8 
 unusedcode.easy  |4 
 5 files changed, 31 deletions(-)

New commits:
commit 952b46570c175dda8b975ad3bc8ef56e747796be
Author: Elton Chung el...@layerjet.com
Date:   Sat Feb 11 00:16:26 2012 +0800

Remove unused code

diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 16b8698..1c0b664 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -377,7 +377,6 @@ public:
 ScChangeAction* GetPrev() const { return pPrev; }
 
 bool IsDeletedIn() const;
-bool IsDeleted() const;
 bool IsDeletedIn( const ScChangeAction* ) const;
 bool IsDeletedInDelType( ScChangeActionType ) const;
 void RemoveAllDeletedIn();
@@ -833,9 +832,7 @@ public:
 
 // NewCell
 bool IsMatrixOrigin() const;
-bool IsMatrixReference() const;
 // OldCell
-bool IsOldMatrixOrigin() const;
 bool IsOldMatrixReference() const;
 };
 
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 82fbd93..9a2ccb5 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -345,11 +345,6 @@ bool ScChangeAction::IsDeletedIn() const
 return GetDeletedIn() != NULL;
 }
 
-bool ScChangeAction::IsDeleted() const
-{
-return IsDeleteType() || IsDeletedIn();
-}
-
 bool ScChangeAction::IsDeletedIn( const ScChangeAction* p ) const
 {
 ScChangeActionLinkEntry* pL = GetDeletedIn();
@@ -2155,16 +2150,6 @@ bool ScChangeActionContent::IsMatrixOrigin() const
 return GetContentCellType(GetNewCell()) == SC_CACCT_MATORG;
 }
 
-bool ScChangeActionContent::IsMatrixReference() const
-{
-return GetContentCellType(GetNewCell()) == SC_CACCT_MATREF;
-}
-
-bool ScChangeActionContent::IsOldMatrixOrigin() const
-{
-return GetContentCellType(GetOldCell()) == SC_CACCT_MATORG;
-}
-
 bool ScChangeActionContent::IsOldMatrixReference() const
 {
 return GetContentCellType(GetOldCell()) == SC_CACCT_MATREF;
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index 9a81555..f9a14a7 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -123,7 +123,6 @@ private:
 void calcMargins(long rTop, long rLeft, long rBottom, long rRight, 
double nPPTX, double nPPTY) const;
 void calcPaperSize(Size rPaperSize, const Rectangle rAlignRect, 
double nPPTX, double nPPTY) const;
 void getEngineSize(ScFieldEditEngine* pEngine, long rWidth, long 
rHeight) const;
-long getEngineWidth(ScFieldEditEngine* pEngine) const;
 bool hasLineBreak() const;
 bool isHyperlinkCell() const;
 
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 82a9905..8122c94 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2327,14 +2327,6 @@ void 
ScOutputData::DrawEditParam::getEngineSize(ScFieldEditEngine* pEngine, long
 rHeight = nEngineHeight;
 }
 
-long ScOutputData::DrawEditParam::getEngineWidth(ScFieldEditEngine* pEngine) 
const
-{
-if (mbBreak  meOrient != SVX_ORIENTATION_STACKED  !mbAsianVertical)
-return 0;
-else
-return static_castlong(pEngine-CalcTextWidth());
-}
-
 bool ScOutputData::DrawEditParam::hasLineBreak() const
 {
 return (mbBreak || (meOrient == SVX_ORIENTATION_STACKED) || 
mbAsianVertical);
diff --git a/unusedcode.easy b/unusedcode.easy
index 540da7c..bf8ac97 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -127,9 +127,6 @@ ScAddInDocs::Insert(ScAddInDocs const*, unsigned short, 
unsigned short)
 ScAddInDocs::Insert(ScDocument* const, unsigned short)
 ScAddInDocs::Insert(ScDocument* const*, unsigned short)
 ScAddInDocs::Remove(ScDocument* const, unsigned short)
-ScChangeAction::IsDeleted() const
-ScChangeActionContent::IsMatrixReference() const
-ScChangeActionContent::IsOldMatrixOrigin() const
 ScChangeActionContent::SetNewValue(rtl::OUString const, ScDocument*)
 ScChartListener::ScChartListener(rtl::OUString const, ScDocument*, ScRange 
const)
 ScChartListener::SetName(rtl::OUString const)
@@ -168,7 +165,6 @@ ScHTMLColOffset_SAR::_ForEach(unsigned short, unsigned 
short, unsigned char (*)(
 ScMyCellInfo::ScMyCellInfo()
 ScNameDefDlg::LinkStubEdModifyHdl(void*, void*)
 
ScNamedRangeObj::getImplementation(com::sun::star::uno::Referencecom::sun::star::uno::XInterface)
-ScOutputData::DrawEditParam::getEngineWidth(ScFieldEditEngine*) const
 ScRTFColTwips::Insert(ScRTFColTwips const*, unsigned short, unsigned short)
 ScRTFColTwips::Insert(unsigned long const, unsigned short)
 ScRTFColTwips::Insert(unsigned long const*, unsigned short)
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-02-09 Thread Kohei Yoshida
 sc/inc/dpcachetable.hxx |   10 ++---
 sc/inc/dpdimsave.hxx|   22 ++--
 sc/inc/dpitemdata.hxx   |   16 +---
 sc/inc/dptablecache.hxx |8 ++--
 sc/source/core/data/dpcachetable.cxx|   16 +---
 sc/source/core/data/dpdimsave.cxx   |   50 
 sc/source/core/data/dpitemdata.cxx  |   15 +++-
 sc/source/core/data/dptablecache.cxx|   18 +-
 sc/source/core/data/dptabres.cxx|2 -
 sc/source/filter/excel/xepivot.cxx  |2 -
 sc/source/filter/xml/XMLExportDataPilot.cxx |2 -
 sc/source/ui/unoobj/dapiuno.cxx |2 -
 12 files changed, 81 insertions(+), 82 deletions(-)

New commits:
commit 2357da95f1382ebb490ca9ed5362d7888e6bcb0c
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Thu Feb 9 17:02:33 2012 -0500

String to rtl::OUString.

diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index 7927b1a..2fc86a8 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -68,7 +68,7 @@ public:
 /** individual filter item used in SingleFilter and GroupFilter. */
 struct FilterItem
 {
-String  maString;
+rtl::OUString maString;
 double  mfValue;
 boolmbHasValue;
 
@@ -89,12 +89,12 @@ public:
 class SingleFilter : public FilterBase
 {
 public:
-explicit SingleFilter(String aString, double fValue, bool bHasValue);
+explicit SingleFilter(const rtl::OUString aString, double fValue, 
bool bHasValue);
 virtual ~SingleFilter() {}
 
 virtual bool match(const ScDPItemData rCellData) const;
 
-const String   getMatchString();
+const rtl::OUString getMatchString() const;
 double  getMatchValue() const;
 boolhasValue() const;
 
@@ -111,7 +111,7 @@ public:
 GroupFilter();
 virtual ~GroupFilter() {}
 virtual bool match(  const  ScDPItemData rCellData ) const;
-void addMatchItem(const String rStr, double fVal, bool bHasValue);
+void addMatchItem(const rtl::OUString rStr, double fVal, bool 
bHasValue);
 size_t getMatchItemCount() const;
 
 private:
@@ -157,7 +157,7 @@ public:
 returned object! */
 const ScDPItemData* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) 
const;
 void  getValue( ScDPValueData rVal, SCCOL nCol, SCROW nRow, bool 
bRepeatIfEmpty) const;
-String getFieldName( SCCOL  nIndex) const;
+rtl::OUString getFieldName(SCCOL nIndex) const;
 
/** Get the unique entries for a field specified by index.  The caller must
make sure that the table is filled before calling function, or it will
diff --git a/sc/inc/dpdimsave.hxx b/sc/inc/dpdimsave.hxx
index 7820ce2..59857fd 100644
--- a/sc/inc/dpdimsave.hxx
+++ b/sc/inc/dpdimsave.hxx
@@ -50,25 +50,25 @@ class ScDPSaveGroupDimension;
 
 class SC_DLLPUBLIC ScDPSaveGroupItem
 {
-String  aGroupName; // name of group
-::std::vectorString   aElements;  // names of items in original 
dimension
+rtl::OUString aGroupName; // name of group
+::std::vectorrtl::OUString aElements;  // names of items in original 
dimension
 
 public:
-ScDPSaveGroupItem( const String rName );
-~ScDPSaveGroupItem();
+ScDPSaveGroupItem( const rtl::OUString rName );
+~ScDPSaveGroupItem();
 
 voidAddToData( ScDPGroupDimension rDataDim, SvNumberFormatter* 
pFormatter ) const;
 
-voidAddElement( const String rName );
+voidAddElement( const rtl::OUString rName );
 voidAddElementsFromGroup( const ScDPSaveGroupItem rGroup );
-const String GetGroupName() const   { return aGroupName; }
-boolRemoveElement( const String rName );   // returns true if found 
(removed)
+const rtl::OUString GetGroupName() const { return aGroupName; }
+boolRemoveElement( const rtl::OUString rName );   // returns true if 
found (removed)
 
 boolIsEmpty() const;
 size_t  GetElementCount() const;
-const String* GetElementByIndex( size_t nIndex ) const;
+const rtl::OUString* GetElementByIndex(size_t nIndex) const;
 
-voidRename( const String rNewName );
+void Rename( const rtl::OUString rNewName );
 
 // remove this group's elements from their groups in rDimension
 // (rDimension must be a different dimension from the one which contains 
this)
@@ -101,11 +101,11 @@ public:
 sal_Int32   GetDatePart() const { return nDatePart; }
 const ScDPNumGroupInfo GetDateInfo() const { return aDateInfo; }
 
-String  CreateGroupName( const String rPrefix );
+rtl::OUString CreateGroupName( const rtl::OUString rPrefix );
 const ScDPSaveGroupItem* GetNamedGroup( const String rGroupName ) const;
 ScDPSaveGroupItem* GetNamedGroupAcc( const String rGroupName );
 void

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

2012-02-07 Thread Kohei Yoshida
 sc/inc/dptabres.hxx  |   12 +
 sc/source/core/data/dptabres.cxx |   79 ---
 2 files changed, 45 insertions(+), 46 deletions(-)

New commits:
commit ece725d7d8fc7d22544785f4e76b28332912ea59
Author: Noel Grandin n...@peralex.com
Date:   Tue Feb 7 12:17:27 2012 -0500

Convert dptabres.cxx in SC module from SV_DECL_PTRARR_DEL to std::vector.

diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index 6864e14..f5c10a2 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -221,8 +221,6 @@ public:
 //  results for a hierarchy dimension
 //
 
-#define SC_DP_RES_GROW  16
-
 class ScDPResultDimension;
 class ScDPDataDimension;
 class ScDPDataMember;
@@ -494,10 +492,7 @@ public:
 ScDPDataDimension*  GetChildDimension() { return 
pChildDimension; }
 };
 
-//! replace PtrArr with 32-bit array 
-
-typedef ScDPDataMember* ScDPDataMemberPtr;
-SV_DECL_PTRARR_DEL(ScDPDataMembers, ScDPDataMemberPtr, SC_DP_RES_GROW)
+typedef std::vectorScDPDataMember* ScDPDataMembers;
 
 
 //  result dimension contains only members
@@ -615,7 +610,7 @@ class ScDPDataDimension
 private:
 const ScDPResultData*   pResultData;
 const ScDPResultDimension* pResultDimension;  // column
-ScDPDataMembers aMembers;
+ScDPDataMembers maMembers;
 sal_BoolbIsDataLayout;  //! or ptr to IntDimension?
 
 public:
@@ -646,7 +641,8 @@ public:
 voidDumpState( const ScDPResultDimension* pRefDim, 
ScDocument* pDoc, ScAddress rPos ) const;
 
 longGetMemberCount() const;
-ScDPDataMember* GetMember(long n) const;
+const ScDPDataMember* GetMember(long n) const;
+ScDPDataMember* GetMember(long n);
 };
 
 // 
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 15fd87b..4f780cd 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -44,6 +44,7 @@
 #include datauno.hxx  // ScDataUnoConversion
 
 #include document.hxx // for DumpState only!
+#include stlalgorithm.hxx
 
 #include math.h
 #include float.h  //! Test !!!
@@ -67,10 +68,6 @@ using ::rtl::OUString;
 
 // ---
 
-SV_IMPL_PTRARR( ScDPDataMembers, ScDPDataMemberPtr );
-
-// ---
-
 static sal_uInt16 nFuncStrIds[12] = // passend zum enum ScSubTotalFunc
 {
 0,  // SUBTOTAL_FUNC_NONE
@@ -243,8 +240,8 @@ sal_Bool ScDPRowMembersOrder::operator()( sal_Int32 
nIndex1, sal_Int32 nIndex2 )
 
 sal_Bool ScDPColMembersOrder::operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 
) const
 {
-ScDPDataMember* pDataMember1 = rDimension.GetMember(nIndex1);
-ScDPDataMember* pDataMember2 = rDimension.GetMember(nIndex2);
+const ScDPDataMember* pDataMember1 = rDimension.GetMember(nIndex1);
+const ScDPDataMember* pDataMember2 = rDimension.GetMember(nIndex2);
 sal_Bool bHide1 = pDataMember1  !pDataMember1-IsVisible();
 sal_Bool bHide2 =  pDataMember2  !pDataMember2-IsVisible();
 if ( bHide1 || bHide2 )
@@ -2314,7 +2311,7 @@ void ScDPDataMember::UpdateRunningTotals( const 
ScDPResultMember* pRefMember,
 sal_Bool bRefDimInCol = ( nRefOrient == 
sheet::DataPilotFieldOrientation_COLUMN );
 sal_Bool bRefDimInRow = ( nRefOrient == 
sheet::DataPilotFieldOrientation_ROW );
 
-const ScDPResultDimension* pSelectDim = NULL;
+ScDPResultDimension* pSelectDim = NULL;
 long nRowPos = 0;
 long nColPos = 0;
 
@@ -3297,7 +3294,7 @@ ScDPDataMember* 
ScDPResultDimension::GetRowReferenceMember( const ScDPRelativePo
 const long* pNextColIndex = pColIndexes;
 while ( *pNextColIndex = 0  pColMember )
 {
-const ScDPDataDimension* pColChild = 
pColMember-GetChildDimension();
+ScDPDataDimension* pColChild = pColMember-GetChildDimension();
 if ( pColChild  *pNextColIndex  pColChild-GetMemberCount() 
)
 pColMember = pColChild-GetMember( *pNextColIndex );
 else
@@ -3349,7 +3346,7 @@ ScDPDataMember* 
ScDPResultDimension::GetColReferenceMember( const ScDPRelativePo
 long nColSkipped = 0;
 while ( *pNextColIndex = 0  pColMember  nColSkipped  nRefDimPos )
 {
-const ScDPDataDimension* pColChild = 
pColMember-GetChildDimension();
+ScDPDataDimension* pColChild = pColMember-GetChildDimension();
 if ( pColChild  *pNextColIndex  pColChild-GetMemberCount() )
 pColMember = pColChild-GetMember( *pNextColIndex );
 else
@@ -3363,7 +3360,7 @@ 

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

2012-02-06 Thread Kohei Yoshida
 sc/inc/appoptio.hxx |8 +++
 sc/inc/docoptio.hxx |9 
 sc/inc/sc.hrc   |2 
 sc/source/core/tool/appoptio.cxx|   68 ++--
 sc/source/core/tool/docoptio.cxx|   63 -
 sc/source/ui/app/scmod.cxx  |   25 +--
 sc/source/ui/inc/tpcompatibility.hxx|5 --
 sc/source/ui/optdlg/tpcompatibility.cxx |   65 +-
 8 files changed, 125 insertions(+), 120 deletions(-)

New commits:
commit 28ff7a37e66c8746a0b176b4ea25e20c1cd135c5
Author: Albert Thuswaldner albert.thuswald...@gmail.com
Date:   Fri Feb 3 11:15:31 2012 +0100

Moved ScTpCompat from docoptions to appoptions

diff --git a/sc/inc/appoptio.hxx b/sc/inc/appoptio.hxx
index 84fbc86..fac4061 100644
--- a/sc/inc/appoptio.hxx
+++ b/sc/inc/appoptio.hxx
@@ -33,6 +33,7 @@
 #include svx/zoomitem.hxx
 #include unotools/configitem.hxx
 #include scdllapi.h
+#include scmod.hxx
 #include global.hxx
 #include optutil.hxx
 
@@ -87,6 +88,8 @@ public:
 
 voidSetShowSharedDocumentWarning( sal_Bool bNew )   { 
mbShowSharedDocumentWarning = bNew; }
 sal_BoolGetShowSharedDocumentWarning() const{ return 
mbShowSharedDocumentWarning; }
+ScOptionsUtil::KeyBindingType GetKeyBindingType() const { return 
meKeyBindingType; }
+voidSetKeyBindingType( ScOptionsUtil::KeyBindingType e ) { 
meKeyBindingType = e; }
 
 
 const ScAppOptions operator=   ( const ScAppOptions rOpt );
@@ -110,6 +113,7 @@ private:
 sal_Int32   nDefaultObjectSizeWidth;
 sal_Int32   nDefaultObjectSizeHeight;
 sal_BoolmbShowSharedDocumentWarning;
+ScOptionsUtil::KeyBindingType meKeyBindingType;
 };
 
 
@@ -128,6 +132,7 @@ class ScAppCfg : public ScAppOptions
 ScLinkConfigItemaContentItem;
 ScLinkConfigItemaSortListItem;
 ScLinkConfigItemaMiscItem;
+ScLinkConfigItemaCompatItem;
 
 DECL_LINK( LayoutCommitHdl, void* );
 DECL_LINK( InputCommitHdl, void* );
@@ -135,6 +140,7 @@ class ScAppCfg : public ScAppOptions
 DECL_LINK( ContentCommitHdl, void* );
 DECL_LINK( SortListCommitHdl, void* );
 DECL_LINK( MiscCommitHdl, void* );
+DECL_LINK( CompatCommitHdl, void* );
 
 com::sun::star::uno::Sequencertl::OUString GetLayoutPropertyNames();
 com::sun::star::uno::Sequencertl::OUString GetInputPropertyNames();
@@ -142,6 +148,7 @@ class ScAppCfg : public ScAppOptions
 com::sun::star::uno::Sequencertl::OUString GetContentPropertyNames();
 com::sun::star::uno::Sequencertl::OUString GetSortListPropertyNames();
 com::sun::star::uno::Sequencertl::OUString GetMiscPropertyNames();
+com::sun::star::uno::Sequencertl::OUString GetCompatPropertyNames();
 
 public:
 ScAppCfg();
@@ -150,7 +157,6 @@ public:
 voidOptionsChanged();   // after direct access to ScAppOptions base 
class
 };
 
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx
index a960ec0..de44cf0 100644
--- a/sc/inc/docoptio.hxx
+++ b/sc/inc/docoptio.hxx
@@ -45,7 +45,6 @@ class SC_DLLPUBLIC ScDocOptions
 SCTAB nInitTabCount;// number of Tabs for new Spreadsheet doc
 ::rtl::OUString aInitTabPrefix;   // The Tab prefix name in new 
Spreadsheet doc
 sal_uInt16 nPrecStandardFormat; // precision for standard format
-ScOptionsUtil::KeyBindingType eKeyBindingType;
 sal_uInt16 nDay;// Null date:
 sal_uInt16 nMonth;
 sal_uInt16 nYear;
@@ -105,9 +104,6 @@ public:
 sal_uInt16  GetStdPrecision() const { return nPrecStandardFormat; }
 voidSetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; }
 
-ScOptionsUtil::KeyBindingType GetKeyBindingType() const { return 
eKeyBindingType; }
-voidSetKeyBindingType( ScOptionsUtil::KeyBindingType e ) { 
eKeyBindingType = e; }
-
 sal_BoolIsCalcAsShown() const   { return bCalcAsShown; }
 voidSetCalcAsShown( sal_Bool bVal ) { bCalcAsShown = bVal; }
 
@@ -145,7 +141,6 @@ inline const ScDocOptions ScDocOptions::operator=( const 
ScDocOptions rCpy )
 aInitTabPrefix  = rCpy.aInitTabPrefix;
 fIterEps= rCpy.fIterEps;
 nPrecStandardFormat = rCpy.nPrecStandardFormat;
-eKeyBindingType = rCpy.eKeyBindingType;
 nDay= rCpy.nDay;
 nMonth  = rCpy.nMonth;
 nYear   = rCpy.nYear;
@@ -175,7 +170,6 @@ inline bool ScDocOptions::operator==( const ScDocOptions 
rOpt ) const
   rOpt.aInitTabPrefix == aInitTabPrefix
   rOpt.fIterEps   == fIterEps
   rOpt.nPrecStandardFormat== nPrecStandardFormat
-  rOpt.eKeyBindingType== eKeyBindingType
   rOpt.nDay   == nDay
   rOpt.nMonth == nMonth
   

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

2012-02-06 Thread Kohei Yoshida
 sc/inc/autoform.hxx   |   62 +-
 sc/source/core/tool/autoform.cxx  |   41 +-
 sc/source/ui/inc/scuiautofmt.hxx  |2 -
 sc/source/ui/miscdlgs/scuiautofmt.cxx |   14 ++-
 sc/source/ui/unoobj/afmtuno.cxx   |   19 +++---
 sc/source/ui/unoobj/cellsuno.cxx  |5 --
 6 files changed, 63 insertions(+), 80 deletions(-)

New commits:
commit 9abbf7c181467e665e4b8da3561a31086b65ed08
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Mon Feb 6 21:50:40 2012 -0500

The usual bool  string conversion.

diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx
index c65a6f4..5ab5ac1 100644
--- a/sc/inc/autoform.hxx
+++ b/sc/inc/autoform.hxx
@@ -200,17 +200,17 @@ public:
 class SC_DLLPUBLIC ScAutoFormatData : public ScDataObject
 {
 private:
-String  aName;
-sal_uInt16  nStrResId;
+rtl::OUString   aName;
+sal_uInt16  nStrResId;
 // common flags of Calc and Writer
-sal_BoolbIncludeFont : 1;
-sal_BoolbIncludeJustify : 1;
-sal_BoolbIncludeFrame : 1;
-sal_BoolbIncludeBackground : 1;
+boolbIncludeFont : 1;
+boolbIncludeJustify : 1;
+boolbIncludeFrame : 1;
+boolbIncludeBackground : 1;
 
 // Calc specific flags
-sal_BoolbIncludeValueFormat : 1;
-sal_BoolbIncludeWidthHeight : 1;
+boolbIncludeValueFormat : 1;
+boolbIncludeWidthHeight : 1;
 
 ScAutoFormatDataField** ppDataField;
 
@@ -224,22 +224,22 @@ public:
 
 virtual ScDataObject* Clone() const { return new ScAutoFormatData( 
*this ); }
 
-voidSetName( const String rName )  { aName = 
rName; nStrResId = USHRT_MAX; }
-voidGetName( String rName ) const  { rName = 
aName; }
+voidSetName( const rtl::OUString rName )  { aName 
= rName; nStrResId = USHRT_MAX; }
+const rtl::OUString GetName() const { return aName; }
 
-sal_BoolGetIncludeValueFormat() const   { return 
bIncludeValueFormat; }
-sal_BoolGetIncludeFont() const  { return 
bIncludeFont; }
-sal_BoolGetIncludeJustify() const   { return 
bIncludeJustify; }
-sal_BoolGetIncludeFrame() const { return 
bIncludeFrame; }
-sal_BoolGetIncludeBackground() const{ return 
bIncludeBackground; }
-sal_BoolGetIncludeWidthHeight() const   { return 
bIncludeWidthHeight; }
+boolGetIncludeValueFormat() const   { return 
bIncludeValueFormat; }
+boolGetIncludeFont() const  { return 
bIncludeFont; }
+boolGetIncludeJustify() const   { return 
bIncludeJustify; }
+boolGetIncludeFrame() const { return 
bIncludeFrame; }
+boolGetIncludeBackground() const{ return 
bIncludeBackground; }
+boolGetIncludeWidthHeight() const   { return 
bIncludeWidthHeight; }
 
-voidSetIncludeValueFormat( sal_Bool bValueFormat )  { 
bIncludeValueFormat = bValueFormat; }
-voidSetIncludeFont( sal_Bool bFont ){ 
bIncludeFont = bFont; }
-voidSetIncludeJustify( sal_Bool bJustify )  { 
bIncludeJustify = bJustify; }
-voidSetIncludeFrame( sal_Bool bFrame )  { 
bIncludeFrame = bFrame; }
-voidSetIncludeBackground( sal_Bool bBackground ){ 
bIncludeBackground = bBackground; }
-voidSetIncludeWidthHeight( sal_Bool bWidthHeight )  { 
bIncludeWidthHeight = bWidthHeight; }
+voidSetIncludeValueFormat( bool bValueFormat )  { 
bIncludeValueFormat = bValueFormat; }
+voidSetIncludeFont( bool bFont ){ bIncludeFont 
= bFont; }
+voidSetIncludeJustify( bool bJustify )  { 
bIncludeJustify = bJustify; }
+voidSetIncludeFrame( bool bFrame )  { 
bIncludeFrame = bFrame; }
+voidSetIncludeBackground( bool bBackground ){ 
bIncludeBackground = bBackground; }
+voidSetIncludeWidthHeight( bool bWidthHeight )  { 
bIncludeWidthHeight = bWidthHeight; }
 
 const SfxPoolItem*  GetItem( sal_uInt16 nIndex, sal_uInt16 nWhich 
) const;
 voidPutItem( sal_uInt16 nIndex, const SfxPoolItem 
rItem );
@@ -247,13 +247,13 @@ public:
 
 const ScNumFormatAbbrevGetNumFormat( sal_uInt16 nIndex ) const;
 
-sal_Bool  

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

2012-02-06 Thread Kohei Yoshida
 sc/inc/autoform.hxx   |   56 -
 sc/source/core/data/table4.cxx|6 -
 sc/source/core/tool/autoform.cxx  |  145 +++---
 sc/source/ui/docshell/docfunc.cxx |8 -
 sc/source/ui/inc/docfunc.hxx  |4 
 sc/source/ui/inc/scuiautofmt.hxx  |4 
 sc/source/ui/miscdlgs/scuiautofmt.cxx |   87 ++--
 sc/source/ui/unoobj/afmtuno.cxx   |   69 
 sc/source/ui/unoobj/cellsuno.cxx  |   14 +--
 sc/source/ui/view/cellsh3.cxx |4 
 10 files changed, 237 insertions(+), 160 deletions(-)

New commits:
commit 72c1b6141d590fb4479925ed8bc88b79357c2bfc
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Tue Feb 7 00:50:36 2012 -0500

ScAutoFormat no longer a child of ScSortedCollection.

diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx
index 5ab5ac1..724d63f 100644
--- a/sc/inc/autoform.hxx
+++ b/sc/inc/autoform.hxx
@@ -69,6 +69,7 @@
 #include global.hxx
 #include zforauto.hxx
 
+#include boost/ptr_container/ptr_map.hpp
 
 struct ScAfVersions;
 
@@ -197,7 +198,7 @@ public:
 };
 
 
-class SC_DLLPUBLIC ScAutoFormatData : public ScDataObject
+class SC_DLLPUBLIC ScAutoFormatData
 {
 private:
 rtl::OUString   aName;
@@ -218,11 +219,9 @@ private:
 SC_DLLPRIVATE const ScAutoFormatDataField GetField( sal_uInt16 nIndex ) 
const;
 
 public:
-ScAutoFormatData();
-ScAutoFormatData( const ScAutoFormatData rData );
-virtual ~ScAutoFormatData();
-
-virtual ScDataObject* Clone() const { return new ScAutoFormatData( 
*this ); }
+ScAutoFormatData();
+ScAutoFormatData( const ScAutoFormatData rData );
+~ScAutoFormatData();
 
 voidSetName( const rtl::OUString rName )  { aName 
= rName; nStrResId = USHRT_MAX; }
 const rtl::OUString GetName() const { return aName; }
@@ -260,23 +259,40 @@ public:
 #endif
 };
 
-class SC_DLLPUBLIC ScAutoFormat : public ScSortedCollection
+class SC_DLLPUBLIC ScAutoFormat
 {
-private:
-boolbSaveLater;
+typedef boost::ptr_maprtl::OUString, ScAutoFormatData MapType;
+MapType maData;
+bool mbSaveLater;
 
 public:
-ScAutoFormat( sal_uInt16 nLim = 4, sal_uInt16 
nDel = 4, sal_Bool bDup = false );
-ScAutoFormat( const ScAutoFormat AutoFormat );
-virtual ~ScAutoFormat();
-virtual ScDataObject* Clone() const { return 
new ScAutoFormat( *this ); }
-ScAutoFormatData*   operator[]( const 
sal_uInt16 nIndex ) const {return (ScAutoFormatData*)At( nIndex );}
-virtual short   Compare( ScDataObject* pKey1, ScDataObject* 
pKey2 ) const;
-boolLoad();
-boolSave();
-sal_uInt16  FindIndexPerName( const rtl::OUString rName ) 
const;
-voidSetSaveLater( bool bSet );
-boolIsSaveLater() const { return 
bSaveLater; }
+typedef MapType::const_iterator const_iterator;
+typedef MapType::iterator iterator;
+
+ScAutoFormat();
+ScAutoFormat(const ScAutoFormat r);
+~ScAutoFormat();
+bool Load();
+bool Save();
+
+void SetSaveLater( bool bSet );
+bool IsSaveLater() const { return mbSaveLater; }
+
+const ScAutoFormatData* findByIndex(size_t nIndex) const;
+ScAutoFormatData* findByIndex(size_t nIndex);
+const_iterator find(const ScAutoFormatData* pData) const;
+iterator find(const ScAutoFormatData* pData);
+const_iterator find(const rtl::OUString rName) const;
+iterator find(const rtl::OUString rName);
+
+bool insert(ScAutoFormatData* pNew);
+void erase(const iterator it);
+
+size_t size() const;
+const_iterator begin() const;
+const_iterator end() const;
+iterator begin();
+iterator end();
 };
 
 
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index dac4111..7990d28 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1591,7 +1591,8 @@ void ScTable::Fill( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
 void ScTable::AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, 
SCROW nEndRow,
 const ScPatternAttr rAttr, sal_uInt16 
nFormatNo)
 {
-ScAutoFormatData* pData = (*ScGlobal::GetOrCreateAutoFormat())[nFormatNo];
+ScAutoFormat rFormat = *ScGlobal::GetOrCreateAutoFormat();
+ScAutoFormatData* pData = rFormat.findByIndex(nFormatNo);
 if (pData)
 {
 ApplyPatternArea(nStartCol, nStartRow, nEndCol, nEndRow, rAttr);
@@ -1603,7 +1604,8 @@ void ScTable::AutoFormat( SCCOL nStartCol, SCROW 
nStartRow, SCCOL nEndCol, SCROW
 {
 if (ValidColRow(nStartCol, nStartRow)  ValidColRow(nEndCol, nEndRow))
 {
-ScAutoFormatData* 

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

2012-02-05 Thread Ivan Timofeev
 sc/inc/cellsuno.hxx |4 --
 sc/source/filter/xml/XMLExportDDELinks.cxx  |   17 --
 sc/source/filter/xml/XMLExportDDELinks.hxx  |2 -
 sc/source/filter/xml/xmlfilti.cxx   |   11 --
 sc/source/filter/xml/xmlfilti.hxx   |2 -
 sc/source/ui/unoobj/cellsuno.cxx|   33 
 sc/source/ui/vba/vbacommentshape.cxx|6 ---
 sc/source/ui/vba/vbacommentshape.hxx|3 -
 sc/source/ui/vba/vbawindows.cxx |5 ---
 sc/source/ui/vba/vbawindows.hxx |1 
 unusedcode.easy |   16 -
 vbahelper/inc/vbahelper/vbashape.hxx|1 
 vbahelper/inc/vbahelper/vbashapes.hxx   |1 
 vbahelper/source/vbahelper/vbacommandbarcontrol.cxx |5 ---
 vbahelper/source/vbahelper/vbacommandbarcontrol.hxx |1 
 vbahelper/source/vbahelper/vbashape.cxx |6 ---
 vbahelper/source/vbahelper/vbashapes.cxx|   28 
 xmloff/inc/SchXMLExport.hxx |2 -
 xmloff/source/chart/SchXMLExport.cxx|   28 
 xmloff/source/chart/SchXMLPlotAreaContext.cxx   |8 
 xmloff/source/chart/SchXMLPlotAreaContext.hxx   |2 -
 21 files changed, 182 deletions(-)

New commits:
commit 9c06348b32bd799241f23b1c2d75a46cf498d015
Author: Elton Chung el...@layerjet.com
Date:   Sun Feb 5 14:39:47 2012 +0800

Remove unused code.

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 8d17087..c2733bd 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -869,10 +869,6 @@ public:
 
 // XML import needs to set results at formula 
cells,
 // not meant for any other purpose.
-voidSetFormulaResultString( const ::rtl::OUString 
rResult );
-voidSetFormulaResultDouble( double fResult );
-voidSetFormulaWithGrammar( const ::rtl::OUString 
rFormula,
-const ::rtl::OUString rFormulaNmsp, const 
formula::FormulaGrammar::Grammar );
 const ScAddressGetPosition() const { return aCellPos; }
 
 voidInputEnglishString( const ::rtl::OUString rText );
diff --git a/sc/source/filter/xml/XMLExportDDELinks.cxx 
b/sc/source/filter/xml/XMLExportDDELinks.cxx
index 81734b9..e828f74 100644
--- a/sc/source/filter/xml/XMLExportDDELinks.cxx
+++ b/sc/source/filter/xml/XMLExportDDELinks.cxx
@@ -54,23 +54,6 @@ ScXMLExportDDELinks::~ScXMLExportDDELinks()
 {
 }
 
-bool ScXMLExportDDELinks::CellsEqual(const bool bPrevEmpty, const bool 
bPrevString, const String sPrevValue, const double fPrevValue,
- const bool bEmpty, const bool bString, const String 
sValue, const double fValue) const
-{
-if (bEmpty == bPrevEmpty)
-if (bEmpty)
-return true;
-else if (bString == bPrevString)
-if (bString)
-return (sPrevValue == sValue);
-else
-return (fPrevValue == fValue);
-else
-return false;
-else
-return false;
-}
-
 void ScXMLExportDDELinks::WriteCell(const ScMatrixValue aVal, sal_Int32 
nRepeat)
 {
 bool bString = ScMatrix::IsNonValueType(aVal.nType);
diff --git a/sc/source/filter/xml/XMLExportDDELinks.hxx 
b/sc/source/filter/xml/XMLExportDDELinks.hxx
index 74171a9..e92fa20 100644
--- a/sc/source/filter/xml/XMLExportDDELinks.hxx
+++ b/sc/source/filter/xml/XMLExportDDELinks.hxx
@@ -39,8 +39,6 @@ class ScXMLExportDDELinks
 {
 ScXMLExportrExport;
 
-boolCellsEqual(const bool bPrevEmpty, const bool 
bPrevString, const String sPrevValue, const double fPrevValue,
-const bool bEmpty, const bool bString, 
const String sValue, const double fValue) const;
 voidWriteCell(const ScMatrixValue aVal, sal_Int32 
nRepeat);
 voidWriteTable(const sal_Int32 nPos);
 public:
diff --git a/sc/source/filter/xml/xmlfilti.cxx 
b/sc/source/filter/xml/xmlfilti.cxx
index 54b7f62..a680370 100644
--- a/sc/source/filter/xml/xmlfilti.cxx
+++ b/sc/source/filter/xml/xmlfilti.cxx
@@ -167,17 +167,6 @@ void ScXMLFilterContext::EndElement()
 
pDatabaseRangeContext-SetFilterConditionSourceRangeAddress(aConditionSourceRangeAddress);
 }
 
-void ScXMLFilterContext::SetCaseSensitive(bool b)
-{
-mrQueryParam.bCaseSens = b;
-}
-
-void ScXMLFilterContext::SetUseRegularExpressions(bool b)
-{
-if (!bUseRegularExpressions)
-bUseRegularExpressions = b;
-}
-
 void ScXMLFilterContext::OpenConnection(bool b)
 {
 maConnStack.push_back(ConnStackItem(b));
diff --git a/sc/source/filter/xml/xmlfilti.hxx 
b/sc/source/filter/xml/xmlfilti.hxx
index 759f954..952b705 100644
--- a/sc/source/filter/xml/xmlfilti.hxx

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

2012-02-02 Thread Julien Nabet
 sc/inc/nameuno.hxx  |5 -
 sc/source/ui/unoobj/nameuno.cxx |8 
 unusedcode.easy |1 -
 3 files changed, 14 deletions(-)

New commits:
commit 0dbda27fb81bc063c865a6829fb035322fd77035
Author: Julien Nabet serval2...@yahoo.fr
Date:   Thu Feb 2 23:18:07 2012 +0100

Remove things not used

diff --git a/sc/inc/nameuno.hxx b/sc/inc/nameuno.hxx
index a83748c..ee66e26 100644
--- a/sc/inc/nameuno.hxx
+++ b/sc/inc/nameuno.hxx
@@ -173,11 +173,6 @@ public:
 throw(::com::sun::star::uno::RuntimeException);
 virtual ::com::sun::star::uno::Sequence ::rtl::OUString  SAL_CALL 
getSupportedServiceNames()
 throw(::com::sun::star::uno::RuntimeException);
-
-// methods accessible via getImplementation()
-voidSetContentWithGrammar( const ::rtl::OUString 
aContent,
-const formula::FormulaGrammar::Grammar 
eGrammar )
-throw(::com::sun::star::uno::RuntimeException);
 };
 
 
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index efb00e6..48baee8 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -265,14 +265,6 @@ void SAL_CALL ScNamedRangeObj::setContent( const 
rtl::OUString aContent )
 Modify_Impl( NULL, NULL, aContStr, NULL, 
NULL,formula::FormulaGrammar::GRAM_PODF_A1 );
 }
 
-void ScNamedRangeObj::SetContentWithGrammar( const ::rtl::OUString aContent,
-const formula::FormulaGrammar::Grammar 
eGrammar )
-throw(::com::sun::star::uno::RuntimeException)
-{
-String aContStr(aContent);
-Modify_Impl( NULL, NULL, aContStr, NULL, NULL, eGrammar );
-}
-
 table::CellAddress SAL_CALL ScNamedRangeObj::getReferencePosition()
 throw(uno::RuntimeException)
 {
diff --git a/unusedcode.easy b/unusedcode.easy
index 15364fe..28a91d7 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -176,7 +176,6 @@ ScMyCellInfo::ScMyCellInfo()
 ScMyStyleRanges::SetStylesToRanges(ScRangeList*, rtl::OUString const*, short, 
rtl::OUString const*, ScXMLImport)
 ScMyStyleRanges::SetStylesToRanges(ScRangeListRef, rtl::OUString const*, 
short, rtl::OUString const*, ScXMLImport)
 ScNameDefDlg::LinkStubEdModifyHdl(void*, void*)
-ScNamedRangeObj::SetContentWithGrammar(rtl::OUString const, 
formula::FormulaGrammar::Grammar)
 
ScNamedRangeObj::getImplementation(com::sun::star::uno::Referencecom::sun::star::uno::XInterface)
 ScOutputData::DrawEditParam::getEngineWidth(ScFieldEditEngine*) const
 ScRTFColTwips::Insert(ScRTFColTwips const*, unsigned short, unsigned short)
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-02-01 Thread Kohei Yoshida
 sc/inc/unitconv.hxx  |   43 +---
 sc/source/core/tool/unitconv.cxx |   82 ---
 2 files changed, 55 insertions(+), 70 deletions(-)

New commits:
commit 051fb0d37a1f1c05ac5876fcfcc9a589938780e4
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Wed Feb 1 21:30:57 2012 -0500

Unit converter data no longer relies on StrCollection.

diff --git a/sc/inc/unitconv.hxx b/sc/inc/unitconv.hxx
index be51d3c..2b000fb 100644
--- a/sc/inc/unitconv.hxx
+++ b/sc/inc/unitconv.hxx
@@ -31,42 +31,41 @@
 
 #include collect.hxx
 
+#include boost/noncopyable.hpp
+#include boost/ptr_container/ptr_map.hpp
 
-class ScUnitConverterData : public StrData
+class ScUnitConverterData
 {
-double  fValue;
-
+rtl::OUString maIndexString;
+double mfValue;
 // not implemented
-ScUnitConverterDataoperator=( const ScUnitConverterData );
+ScUnitConverterData operator=( const ScUnitConverterData );
 
 public:
-ScUnitConverterData( const String rFromUnit,
-const String rToUnit, double fValue = 1.0 );
-ScUnitConverterData( const ScUnitConverterData );
-virtual ~ScUnitConverterData() {};
-
-virtual ScDataObject*   Clone() const;
+ScUnitConverterData( const rtl::OUString rFromUnit,
+const rtl::OUString rToUnit, double fValue = 1.0 );
+ScUnitConverterData( const ScUnitConverterData );
+~ScUnitConverterData();
 
-double  GetValue() const{ return fValue; }
-
-static  voidBuildIndexString( String rStr,
-const String rFromUnit, const String rToUnit 
);
+double GetValue() const;
+const rtl::OUString GetIndexString() const;
 
+static rtl::OUString BuildIndexString(
+const rtl::OUString rFromUnit, const rtl::OUString rToUnit );
 };
 
 
-class ScUnitConverter : public ScStrCollection
+class ScUnitConverter : public boost::noncopyable
 {
-// not implemented
-ScUnitConverter( const ScUnitConverter );
-ScUnitConverteroperator=( const ScUnitConverter );
+typedef boost::ptr_maprtl::OUString, ScUnitConverterData MapType;
+MapType maData;
 
 public:
-ScUnitConverter( sal_uInt16 nInit = 16, sal_uInt16 
nDelta = 4 );
-virtual ~ScUnitConverter() {};
+ScUnitConverter();
+~ScUnitConverter();
 
-sal_BoolGetValue( double fValue, const String 
rFromUnit,
-const String rToUnit ) const;
+bool GetValue(
+double fValue, const rtl::OUString rFromUnit, const rtl::OUString 
rToUnit ) const;
 };
 
 
diff --git a/sc/source/core/tool/unitconv.cxx b/sc/source/core/tool/unitconv.cxx
index 9392bd8..b37379c 100644
--- a/sc/source/core/tool/unitconv.cxx
+++ b/sc/source/core/tool/unitconv.cxx
@@ -48,52 +48,36 @@ const sal_Unicode cDelim = 0x01;// Delimiter 
zwischen From und To
 
 // --- ScUnitConverterData 
 
-ScUnitConverterData::ScUnitConverterData( const String rFromUnit,
-const String rToUnit, double fVal )
-:
-StrData( rFromUnit ),
-fValue( fVal )
-{
-String aTmp;
-ScUnitConverterData::BuildIndexString( aTmp, rFromUnit, rToUnit );
-SetString( aTmp );
-}
+ScUnitConverterData::ScUnitConverterData(
+const rtl::OUString rFromUnit, const rtl::OUString rToUnit, double 
fValue ) :
+maIndexString(BuildIndexString(rFromUnit, rToUnit)),
+mfValue(fValue) {}
 
+ScUnitConverterData::ScUnitConverterData( const ScUnitConverterData r ) :
+maIndexString(r.maIndexString),
+mfValue(r.mfValue) {}
 
-ScUnitConverterData::ScUnitConverterData( const ScUnitConverterData r )
-:
-StrData( r ),
-fValue( r.fValue )
+ScUnitConverterData::~ScUnitConverterData() {}
+
+double ScUnitConverterData::GetValue() const
 {
+return mfValue;
 }
 
-
-ScDataObject* ScUnitConverterData::Clone() const
+const rtl::OUString ScUnitConverterData::GetIndexString() const
 {
-return new ScUnitConverterData( *this );
+return maIndexString;
 }
 
-
-void ScUnitConverterData::BuildIndexString( String rStr,
-const String rFromUnit, const String rToUnit )
+rtl::OUString ScUnitConverterData::BuildIndexString(
+const rtl::OUString rFromUnit, const rtl::OUString rToUnit )
 {
-#if 1
-// case sensitive
-rStr = rFromUnit;
-rStr += cDelim;
-rStr += rToUnit;
-#else
-// not case sensitive
-rStr = rFromUnit;
-String aTo( rToUnit );
-ScGlobal::pCharClass-toUpper( rStr );
-ScGlobal::pCharClass-toUpper( aTo );
-rStr += cDelim;
-rStr += aTo;
-#endif
+rtl::OUStringBuffer aBuf(rFromUnit);
+aBuf.append(cDelim);
+aBuf.append(rToUnit);
+return aBuf.makeStringAndClear();
 }
 
-
 // 

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

2012-01-31 Thread Noel Power
 sc/inc/scdll.hxx  |1 
 sc/source/core/inc/ddelink.hxx|1 
 sc/source/core/tool/ddelink.cxx   |   11 -
 sc/source/ui/app/scdll.cxx|   10 
 sc/source/ui/dbgui/fieldwnd.cxx   |5 
 sc/source/ui/inc/areasave.hxx |1 
 sc/source/ui/inc/cellmergeoption.hxx  |1 
 sc/source/ui/inc/fieldwnd.hxx |1 
 sc/source/ui/inc/scuitphfedit.hxx |4 ---
 sc/source/ui/pagedlg/scuitphfedit.cxx |   39 --
 sc/source/ui/undo/areasave.cxx|5 
 sc/source/ui/view/cellmergeoption.cxx |9 ---
 unusedcode.easy   |9 ---
 13 files changed, 97 deletions(-)

New commits:
commit 9c66fca6ceaa3ba4ad79264a56a992828a92f536
Author: Elton Chung el...@elton.tk
Date:   Tue Jan 31 12:36:47 2012 +

Remove unsed code

diff --git a/sc/inc/scdll.hxx b/sc/inc/scdll.hxx
index 93cff7e..43a9c9f 100644
--- a/sc/inc/scdll.hxx
+++ b/sc/inc/scdll.hxx
@@ -61,7 +61,6 @@ public:
 
 // DLL-init/exit-code must be linked to the DLL only
 static void Init(); // called directly after loading the DLL
-static void Exit(); // called directly befor unloading the DLL
 
 static sal_uLongDetectFilter( SfxMedium rMedium, const SfxFilter** 
ppFilter,
 SfxFilterFlags nMust, SfxFilterFlags nDont 
);
diff --git a/sc/source/core/inc/ddelink.hxx b/sc/source/core/inc/ddelink.hxx
index e3794e4..216d6d6 100644
--- a/sc/source/core/inc/ddelink.hxx
+++ b/sc/source/core/inc/ddelink.hxx
@@ -87,7 +87,6 @@ public:
 const String   GetItem() const { return aItem; }
 sal_uInt8   GetMode() const { return nMode; }
 
-voidResetValue();   // Wert zuruecksetzen
 voidTryUpdate();
 
 sal_BoolNeedsUpdate() const { return bNeedUpdate; }
diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx
index 3bd75ae..5d36e52 100644
--- a/sc/source/core/tool/ddelink.cxx
+++ b/sc/source/core/tool/ddelink.cxx
@@ -228,17 +228,6 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged(
 return SUCCESS;
 }
 
-void ScDdeLink::ResetValue()
-{
-pResult.reset();
-
-//  Es hat sich was getan...
-//  Tracking, FID_DATACHANGED etc. passiert von aussen
-
-if (HasListeners())
-Broadcast( ScHint( SC_HINT_DATACHANGED, ScAddress(), NULL ) );
-}
-
 void ScDdeLink::ListenersGone()
 {
 sal_Bool bWas = bIsInUpdate;
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 9cf9555..0a57bf6 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -312,16 +312,6 @@ void ScDLL::Init()
 //  StarOne Services are now handled in the registry
 }
 
-void ScDLL::Exit()
-{
-// the SxxModule must be destroyed
-ScModule **ppShlPtr = (ScModule**) GetAppData(SHL_CALC);
-delete (*ppShlPtr);
-(*ppShlPtr) = NULL;
-
-//  ScGlobal::Clear ist schon im Module-dtor
-}
-
 //--
 //  Statusbar
 //--
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index 40eb873..9139be4 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -254,11 +254,6 @@ size_t ScDPFieldControlBase::GetSelectedField() const
 return mnFieldSelected;
 }
 
-void ScDPFieldControlBase::SetSelectedField(size_t nSelected)
-{
-mnFieldSelected = nSelected;
-}
-
 vectorScDPFieldControlBase::FieldName ScDPFieldControlBase::GetFieldNames()
 {
 return maFieldNames;
diff --git a/sc/source/ui/inc/areasave.hxx b/sc/source/ui/inc/areasave.hxx
index c9ff348..1a0b1cd 100644
--- a/sc/source/ui/inc/areasave.hxx
+++ b/sc/source/ui/inc/areasave.hxx
@@ -78,7 +78,6 @@ public:
 
 const ScAreaLinkSaver* operator[](size_t nIndex) const;
 size_t size() const;
-void clear();
 void push_back(ScAreaLinkSaver* p);
 };
 
diff --git a/sc/source/ui/inc/cellmergeoption.hxx 
b/sc/source/ui/inc/cellmergeoption.hxx
index ad5fe34..62e4279 100644
--- a/sc/source/ui/inc/cellmergeoption.hxx
+++ b/sc/source/ui/inc/cellmergeoption.hxx
@@ -44,7 +44,6 @@ struct ScCellMergeOption
 SCROW mnEndRow;
 bool mbCenter;
 
-explicit ScCellMergeOption();
 explicit ScCellMergeOption(const ScRange rRange);
 explicit ScCellMergeOption(SCCOL nStartCol, SCROW nStartRow,
SCCOL nEndCol, SCROW nEndRow,
diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx
index 2b232cf..49fc2ed 100644
--- a/sc/source/ui/inc/fieldwnd.hxx
+++ b/sc/source/ui/inc/fieldwnd.hxx
@@ -149,7 +149,6 @@ public:
 voidGetExistingIndex( const Point rPos, size_t rnIndex );
 
 size_t GetSelectedField() const;
-void SetSelectedField(size_t nSelected);
 
 /** Selects the next field. Called i.e. after 

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

2012-01-30 Thread Kohei Yoshida
 sc/inc/cell.hxx|2 ++
 sc/inc/formularesult.hxx   |   12 
 sc/source/core/data/cell.cxx   |5 +
 sc/source/core/data/table4.cxx |1 +
 4 files changed, 20 insertions(+)

New commits:
commit e2b11f4fd79dce4116badb0ecf6477546ca5d0d4
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Mon Jan 30 16:10:48 2012 -0500

Prevent excessive references to single token instance during fill.

Because if not, we may run out of the 16-bit integer space to store
reference count.

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 52244f6..3bc7aee 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -535,6 +535,8 @@ public:
 boolIsMultilineResult();
 
 voidMaybeInterpret();
+
+voidResetFormulaResult();
 };
 
 //  Iterator for references in a formula cell
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index c1cb906..94c62f8 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -117,6 +117,8 @@ public:
 mpToken-DecRef();
 }
 
+inline void Reset();
+
 /** Well, guess what ... */
 inline  ScFormulaResultoperator=( const ScFormulaResult  r );
 
@@ -216,6 +218,16 @@ public:
 inline ScMatrixFormulaCellToken* GetMatrixFormulaCellTokenNonConst();
 };
 
+inline void ScFormulaResult::Reset()
+{
+ResetToDefaults();
+
+if (mbToken  mpToken)
+mpToken-DecRef();
+
+mbToken = true;
+mpToken = NULL;
+}
 
 inline void ScFormulaResult::ResetToDefaults()
 {
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 2f3df26..1f89aed 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -2041,6 +2041,11 @@ void ScFormulaCell::MaybeInterpret()
 Interpret();
 }
 
+void ScFormulaCell::ResetFormulaResult()
+{
+aResult.Reset();
+}
+
 EditTextObject* ScFormulaCell::CreateURLObject()
 {
 String aCellText;
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index dac4111..6a21a07 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -429,6 +429,7 @@ void ScTable::FillFormula(sal_uLong /* nFormulaCounter */, 
bool /* bFirst */, S
 pDocument-SetNoListening( true );  // noch falsche Referenzen
 ScAddress aAddr( nDestCol, nDestRow, nTab );
 ScFormulaCell* pDestCell = new ScFormulaCell( *pSrcCell, *pDocument, aAddr 
);
+pDestCell-ResetFormulaResult(); // formula cell is interpreted later 
during fill.
 aCol[nDestCol].Insert(nDestRow, pDestCell);
 
 if ( bLast  pDestCell-GetMatrixFlag() )
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-01-23 Thread Kohei Yoshida
 sc/inc/dpobject.hxx  |7 ++
 sc/source/core/data/dpobject.cxx |  121 +--
 2 files changed, 124 insertions(+), 4 deletions(-)

New commits:
commit 561b044d62f4701e51abb4a7c47ce3b07f788f8e
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Mon Jan 23 16:34:15 2012 -0500

Fix refresh problem on pivot tables whose data cache have not been created.

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index a894833..f7126b1 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -328,6 +328,7 @@ public:
 ScDocument* mpDoc;
 public:
 DBCaches(ScDocument* pDoc);
+bool hasCache(sal_Int32 nSdbType, const rtl::OUString rDBName, const 
rtl::OUString rCommand) const;
 const ScDPCache* getCache(sal_Int32 nSdbType, const ::rtl::OUString 
rDBName, const ::rtl::OUString rCommand);
 
 private:
@@ -382,6 +383,12 @@ private:
 /** Only to be called from ScDPCache::RemoveReference(). */
 void RemoveCache(const ScDPCache* pCache);
 
+void GetAllTables(const ScRange rSrcRange, std::setScDPObject* rRefs) 
const;
+void GetAllTables(const rtl::OUString rSrcName, std::setScDPObject* 
rRefs) const;
+void GetAllTables(
+sal_Int32 nSdbType, const ::rtl::OUString rDBName, const 
::rtl::OUString rCommand,
+std::setScDPObject* rRefs) const;
+
 private:
 typedef ::boost::ptr_vectorScDPObject TablesType;
 
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 984d3de..d5ac788 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2680,6 +2680,13 @@ bool ScDPCollection::DBType::less::operator() (const 
DBType left, const DBType
 
 ScDPCollection::DBCaches::DBCaches(ScDocument* pDoc) : mpDoc(pDoc) {}
 
+bool ScDPCollection::DBCaches::hasCache(sal_Int32 nSdbType, const OUString 
rDBName, const OUString rCommand) const
+{
+DBType aType(nSdbType, rDBName, rCommand);
+CachesType::const_iterator itr = maCaches.find(aType);
+return itr != maCaches.end();
+}
+
 const ScDPCache* ScDPCollection::DBCaches::getCache(sal_Int32 nSdbType, const 
OUString rDBName, const OUString rCommand)
 {
 DBType aType(nSdbType, rDBName, rCommand);
@@ -2872,13 +2879,27 @@ sal_uLong ScDPCollection::ReloadCache(ScDPObject* 
pDPObj, std::setScDPObject*
 {
 // cache by named range
 ScDPCollection::NameCaches rCaches = GetNameCaches();
-rCaches.updateCache(pDesc-GetRangeName(), 
pDesc-GetSourceRange(), rRefs);
+if (rCaches.hasCache(pDesc-GetRangeName()))
+rCaches.updateCache(pDesc-GetRangeName(), 
pDesc-GetSourceRange(), rRefs);
+else
+{
+// Not cached yet.  Collect all tables that use this named
+// range as data source.
+GetAllTables(pDesc-GetRangeName(), rRefs);
+}
 }
 else
 {
 // cache by cell range
 ScDPCollection::SheetCaches rCaches = GetSheetCaches();
-rCaches.updateCache(pDesc-GetSourceRange(), rRefs);
+if (rCaches.hasCache(pDesc-GetSourceRange()))
+rCaches.updateCache(pDesc-GetSourceRange(), rRefs);
+else
+{
+// Not cached yet.  Collect all tables that use this range as
+// data source.
+GetAllTables(pDesc-GetSourceRange(), rRefs);
+}
 }
 }
 else if (pDPObj-IsImportData())
@@ -2889,8 +2910,15 @@ sal_uLong ScDPCollection::ReloadCache(ScDPObject* 
pDPObj, std::setScDPObject*
 return STR_ERR_DATAPILOTSOURCE;
 
 ScDPCollection::DBCaches rCaches = GetDBCaches();
-rCaches.updateCache(
-pDesc-GetCommandType(), pDesc-aDBName, pDesc-aObject, rRefs);
+if (rCaches.hasCache(pDesc-GetCommandType(), pDesc-aDBName, 
pDesc-aObject))
+rCaches.updateCache(
+pDesc-GetCommandType(), pDesc-aDBName, pDesc-aObject, 
rRefs);
+else
+{
+// Not cached yet.  Collect all tables that use this range as
+// data source.
+GetAllTables(pDesc-GetCommandType(), pDesc-aDBName, 
pDesc-aObject, rRefs);
+}
 }
 return 0;
 }
@@ -3116,6 +3144,91 @@ void ScDPCollection::RemoveCache(const ScDPCache* pCache)
 return;
 }
 
+void ScDPCollection::GetAllTables(const ScRange rSrcRange, 
std::setScDPObject* rRefs) const
+{
+std::setScDPObject* aRefs;
+TablesType::const_iterator it = maTables.begin(), itEnd = maTables.end();
+for (; it != itEnd; ++it)
+{
+const ScDPObject rObj = *it;
+if (!rObj.IsSheetData())
+// Source is not a sheet range.
+continue;
+
+const ScSheetSourceDesc* pDesc = rObj.GetSheetDesc();
+if (!pDesc)
+continue;
+
+if (pDesc-HasRangeName())
+// This table has a range name as its 

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

2012-01-20 Thread Kohei Yoshida
 sc/inc/rangenam.hxx  |2 +-
 sc/source/core/tool/rangenam.cxx |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 657b3c889ae107d9ccaaab569929a3a1abde3200
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Sat Jan 21 00:08:29 2012 -0500

fdo#44831: Named range should overwrite existing name.

When inserting a new named range, it should overwrite any existing
name if one exists.  That was the old behavior in 3.3 prior to my
range name rework, and because of ptr_map not overwriting existing
key, that behavior had changed unintentionally.

Let's revert to the old behavior.

diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 0e8de43..ce0e208 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -222,7 +222,7 @@ public:
 SC_DLLPUBLIC size_t size() const;
 bool empty() const;
 
-/** Insert object into set if not a duplicate.
+/** Insert object into set.
 @ATTENTION: The underlying ::boost::ptr_set_adapter::insert(p) takes
 ownership of p and if it can't insert it deletes the object! So, if
 this insert here returns false the object where p pointed to is gone!
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 0766f00..da92c7c 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -894,6 +894,7 @@ bool ScRangeName::insert(ScRangeData* p)
 }
 
 rtl::OUString aName(p-GetUpperName());
+maData.erase(aName); // ptr_map won't insert it if a duplicate name exists.
 pairDataType::iterator, bool r = maData.insert(aName, p);
 if (r.second)
 {
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-01-20 Thread Kohei Yoshida
 sc/inc/rangenam.hxx  |1 +
 sc/source/core/tool/rangenam.cxx |9 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit de8d1f922acca8e0df5ecb016d27126124e2c3d1
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Sat Jan 21 01:08:32 2012 -0500

Oops I shouldn't have erased names directly.

We always need to remove the index map when removing a name.

diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index ce0e208..53e9ec8 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -230,6 +230,7 @@ public:
 SC_DLLPUBLIC bool insert(ScRangeData* p);
 
 void erase(const ScRangeData r);
+void erase(const rtl::OUString rName);
 
 /**
  * Erase by iterator position.  Note that this method doesn't check for
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index da92c7c..3de3b22 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -894,7 +894,7 @@ bool ScRangeName::insert(ScRangeData* p)
 }
 
 rtl::OUString aName(p-GetUpperName());
-maData.erase(aName); // ptr_map won't insert it if a duplicate name exists.
+erase(aName); // ptr_map won't insert it if a duplicate name exists.
 pairDataType::iterator, bool r = maData.insert(aName, p);
 if (r.second)
 {
@@ -909,7 +909,12 @@ bool ScRangeName::insert(ScRangeData* p)
 
 void ScRangeName::erase(const ScRangeData r)
 {
-DataType::iterator itr = maData.find(r.GetUpperName());
+erase(r.GetUpperName());
+}
+
+void ScRangeName::erase(const rtl::OUString rName)
+{
+DataType::iterator itr = maData.find(rName);
 if (itr != maData.end())
 erase(itr);
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-01-17 Thread Thomas Arnhold
 sc/inc/dpglobal.hxx  |6 ---
 sc/inc/dpobject.hxx  |4 --
 sc/inc/dpsave.hxx|1 
 sc/inc/dptablecache.hxx  |5 ---
 sc/source/core/data/dpobject.cxx |   39 ---
 sc/source/core/data/dpsave.cxx   |   57 --
 sc/source/core/data/dptablecache.cxx |   58 ---
 sc/source/ui/dbgui/fieldwnd.cxx  |   11 --
 sc/source/ui/inc/fieldwnd.hxx|6 ---
 unusedcode.easy  |   14 
 10 files changed, 201 deletions(-)

New commits:
commit a47cb498471f38987c248519435bc4867ffa456e
Author: Thomas Arnhold tho...@arnhold.org
Date:   Tue Jan 17 12:53:28 2012 +0100

remove unused ScDP* methods

diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx
index 9d99b69..55a6aea 100644
--- a/sc/inc/dpglobal.hxx
+++ b/sc/inc/dpglobal.hxx
@@ -136,23 +136,17 @@ public:
 // case insensitive equality
 static sal_Int32Compare( const ScDPItemData rA, const ScDPItemData 
rB );
 
-#if OSL_DEBUG_LEVEL  1
-voiddump() const;
-#endif
-
 public:
 bool IsHasData() const ;
 bool IsHasErr() const ;
 bool IsValue() const;
 String  GetString() const ;
 double  GetValue() const ;
-sal_uLongGetNumFormat() const ;
 bool HasStringData() const ;
 bool IsDate() const;
 bool HasDatePart() const;
 void SetDate( bool b ) ;
 
-TypedStrData*  CreateTypeString( );
 sal_uInt8GetType() const;
 sal_uInt8  GetFlag() throw() { return mbFlag; }
 const sal_uInt8  GetFlag() const throw() { return 
const_castScDPItemData*(this)-GetFlag(); }
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 47c1999..a894833 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -278,7 +278,6 @@ public:
 
 private:
 void updateCache(const ScRange rRange, std::setScDPObject* rRefs);
-void removeCache(const ScRange rRange);
 bool remove(const ScDPCache* p);
 };
 
@@ -298,7 +297,6 @@ public:
 size_t size() const;
 private:
 void updateCache(const rtl::OUString rName, const ScRange rRange, 
std::setScDPObject* rRefs);
-void removeCache(const ::rtl::OUString rName);
 bool remove(const ScDPCache* p);
 };
 
@@ -331,7 +329,6 @@ public:
 public:
 DBCaches(ScDocument* pDoc);
 const ScDPCache* getCache(sal_Int32 nSdbType, const ::rtl::OUString 
rDBName, const ::rtl::OUString rCommand);
-size_t size() const;
 
 private:
 com::sun::star::uno::Referencecom::sun::star::sdbc::XRowSet 
createRowSet(
@@ -339,7 +336,6 @@ public:
 
 void updateCache(sal_Int32 nSdbType, const ::rtl::OUString rDBName, 
const ::rtl::OUString rCommand,
  std::setScDPObject* rRefs);
-void removeCache(sal_Int32 nSdbType, const ::rtl::OUString rDBName, 
const ::rtl::OUString rCommand);
 bool remove(const ScDPCache* p);
 };
 
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index fc16b49..ee2fd6d 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -328,7 +328,6 @@ public:
 { return bDrillDown; }
 
 void WriteToSource( const 
com::sun::star::uno::Referencecom::sun::star::sheet::XDimensionsSupplier 
xSource );
-void Refresh( const 
com::sun::star::uno::Referencecom::sun::star::sheet::XDimensionsSupplier 
xSource );
 bool IsEmpty() const;
 
 const ScDPDimensionSaveData* GetExistingDimensionData() const
diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx
index dcfc066..c4c2ebc 100644
--- a/sc/inc/dptablecache.hxx
+++ b/sc/inc/dptablecache.hxx
@@ -103,19 +103,15 @@ public:
 SCROW GetIdByItemData( long nDim, const String sItemData ) const;
 SCROW GetIdByItemData( long nDim, const ScDPItemData rData ) const;
 
-SCROW GetAdditionalItemID ( const String sItemData ) const;
 SCROW GetAdditionalItemID( const ScDPItemData rData ) const;
 
 SCCOL GetDimensionIndex( String sName) const;
-const ScDPItemData* GetSortedItemData( SCCOL nDim, SCROW nOrder ) const;
 sal_uLong GetNumType ( sal_uLong nFormat ) const;
 sal_uLong GetNumberFormat( long nDim ) const;
 bool  IsDateDimension( long nDim ) const ;
-sal_uLong GetDimNumType( SCCOL nDim) const;
 SCROW GetDimMemberCount( SCCOL nDim ) const;
 SCROW GetOrder( long nDim, SCROW nIndex ) const;
 
-SCROW GetSortedItemDataId( SCCOL nDim, SCROW nOrder ) const;
 const DataListType 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);
@@ -123,7 +119,6 @@ public:
 SCROW  GetRowCount() const;
 SCROW  GetItemDataId( sal_uInt16 nDim, SCROW nRow, bool bRepeatIfEmpty ) 
const;
 String GetDimensionName( sal_uInt16 nColumn ) const;
-bool IsEmptyMember( SCROW nRow, 

[Libreoffice-commits] .: sc/inc sc/source sfx2/source tools/inc tools/source unusedcode.easy vcl/generic vcl/inc vcl/source xmlsecurity/source

2012-01-17 Thread Thomas Arnhold
 sc/inc/cell.hxx   |1 
 sc/inc/document.hxx   |1 
 sc/source/core/data/cell2.cxx |   26 ---
 sc/source/core/data/document.cxx  |   23 ---
 sc/source/core/tool/scmatrix.cxx  |   11 -
 sc/source/ui/inc/namedlg.hxx  |1 
 sc/source/ui/namedlg/namedlg.cxx  |   14 --
 sc/source/ui/vba/vbachart.cxx |   12 -
 sc/source/ui/vba/vbachart.hxx |1 
 sfx2/source/appl/appuno.cxx   |   11 -
 tools/inc/tools/datetime.hxx  |1 
 tools/inc/tools/line.hxx  |4 
 tools/source/datetime/datetime.cxx|   17 --
 tools/source/generic/line.cxx |  147 --
 unusedcode.easy   |   15 --
 vcl/generic/glyphs/glyphcache.cxx |9 -
 vcl/inc/generic/glyphcache.hxx|1 
 vcl/inc/vcl/image.hxx |2 
 vcl/inc/vcl/lineinfo.hxx  |3 
 vcl/source/gdi/image.cxx  |   35 -
 vcl/source/gdi/lineinfo.cxx   |7 -
 xmlsecurity/source/framework/elementcollector.cxx |   32 
 xmlsecurity/source/framework/elementcollector.hxx |2 
 23 files changed, 376 deletions(-)

New commits:
commit 804e86170ff2570fd3826b4ac26d1c927e751ac3
Author: Thomas Arnhold tho...@arnhold.org
Date:   Tue Jan 17 15:28:11 2012 +0100

remove unused methods

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index fa1b719..52244f6 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -454,7 +454,6 @@ public:
 voidUpdateRenameTab(SCTAB nTable, const String rName);
 boolTestTabRefAbs(SCTAB nTable);
 voidUpdateCompile( bool bForceIfNameInUse = false );
-boolIsRangeNameInUse(sal_uInt16 nIndex) const;
 voidFindRangeNamesInUse(std::setsal_uInt16 rIndexes) const;
 voidReplaceRangeNamesInUse( const ScRangeData::IndexMap rMap 
);
 boolIsSubTotal() const  { return 
bSubTotal; }
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 2d232e7..4a0c186 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -576,7 +576,6 @@ public:
 static SC_DLLPUBLIC bool ValidTabName( const rtl::OUString rName );
 
 SC_DLLPUBLIC bool   ValidNewTabName( const rtl::OUString rName ) 
const;
-SC_DLLPUBLIC bool   ValidNewTabName( const 
std::vectorrtl::OUString rName ) const;
 SC_DLLPUBLIC void   CreateValidTabName(rtl::OUString rName) const;
 SC_DLLPUBLIC void   
CreateValidTabNames(std::vectorrtl::OUString aNames, SCTAB nCount) const;
 
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 95e9bc7..e06d466 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -1534,32 +1534,6 @@ void ScFormulaCell::UpdateGrow( const ScRange rArea, 
SCCOL nGrowX, SCROW nGrowY
 StartListeningTo( pDocument );  // Listener wie vorher
 }
 
-bool lcl_IsRangeNameInUse(size_t nIndex, ScTokenArray* pCode, ScRangeName* 
pNames)
-{
-for (FormulaToken* p = pCode-First(); p; p = pCode-Next())
-{
-if (p-GetOpCode() == ocName)
-{
-if (p-GetIndex() == static_castsal_uInt16(nIndex))
-return true;
-else
-{
-//  RangeData kann Null sein in bestimmten Excel-Dateien
-ScRangeData* pSubName = pNames-findByIndex(p-GetIndex());
-if (pSubName  lcl_IsRangeNameInUse(nIndex,
-pSubName-GetCode(), pNames))
-return true;
-}
-}
-}
-return false;
-}
-
-bool ScFormulaCell::IsRangeNameInUse(sal_uInt16 nIndex) const
-{
-return lcl_IsRangeNameInUse( nIndex, pCode, pDocument-GetRangeName() );
-}
-
 void lcl_FindRangeNamesInUse(std::setsal_uInt16 rIndexes, ScTokenArray* 
pCode, ScRangeName* pNames)
 {
 for (FormulaToken* p = pCode-First(); p; p = pCode-Next())
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index dbc4cec..e5420cb 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -302,29 +302,6 @@ bool ScDocument::ValidNewTabName( const rtl::OUString 
rName ) const
 }
 
 
-bool ScDocument::ValidNewTabName( const std::vectorrtl::OUString rNames ) 
const//TODO:FIXME what is if there are duplicates in rNames
-{
-bool bValid = true;
-std::vectorrtl::OUString::const_iterator nameIter = rNames.begin();
-for (;nameIter != rNames.end()  bValid; ++nameIter)
-{
-bValid = ValidTabName(*nameIter);
-}
-TableContainer::const_iterator it = maTabs.begin();
-for (; it != maTabs.end()  bValid; ++it)
-

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

2012-01-13 Thread Kohei Yoshida
 sc/inc/dptablecache.hxx  |2 ++
 sc/source/core/data/dptablecache.cxx |   14 +-
 2 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit e60b212cc9f02d68ee638106a5881c21ac40ce8d
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Fri Jan 13 13:56:34 2012 -0500

Avoid double deletion during data cache object destruction.

diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx
index 882f422..dcfc066 100644
--- a/sc/inc/dptablecache.hxx
+++ b/sc/inc/dptablecache.hxx
@@ -93,6 +93,8 @@ private:
 
 mutable ScDPItemDataPoolmaAdditionalData;
 
+bool mbDisposing;
+
 public:
 void AddReference(ScDPObject* pObj) const;
 void RemoveReference(ScDPObject* pObj) const;
diff --git a/sc/source/core/data/dptablecache.cxx 
b/sc/source/core/data/dptablecache.cxx
index a65785b..ed45647 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -429,7 +429,8 @@ bool ScDPCache::operator== ( const ScDPCache r ) const
 
 ScDPCache::ScDPCache(ScDocument* pDoc) :
 mpDoc( pDoc ),
-mnColumnCount ( 0 )
+mnColumnCount ( 0 ),
+mbDisposing(false)
 {
 }
 
@@ -448,10 +449,9 @@ struct ClearObjectSource : 
std::unary_functionScDPObject*, void
 ScDPCache::~ScDPCache()
 {
 // Make sure no live ScDPObject instances hold reference to this cache any
-// more.  We need to use a copied set because the referencing objects will
-// modify the original when clearing their source.
-ObjectSetType aRefs(maRefObjects);
-std::for_each(aRefs.begin(), aRefs.end(), ClearObjectSource());
+// more.
+mbDisposing = true;
+std::for_each(maRefObjects.begin(), maRefObjects.end(), 
ClearObjectSource());
 }
 
 bool ScDPCache::IsValid() const
@@ -1010,6 +1010,10 @@ void ScDPCache::AddReference(ScDPObject* pObj) const
 
 void ScDPCache::RemoveReference(ScDPObject* pObj) const
 {
+if (mbDisposing)
+// Object being deleted.
+return;
+
 maRefObjects.erase(pObj);
 if (maRefObjects.empty())
 mpDoc-GetDPCollection()-RemoveCache(this);
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-01-11 Thread Stephan Bergmann
 sc/inc/global.hxx |1 
 sc/source/core/data/global.cxx|5 
 sc/source/core/data/table4.cxx|  232 --
 sc/source/ui/docshell/docfunc.cxx |4 
 sc/source/ui/miscdlgs/scuiautofmt.cxx |4 
 sc/source/ui/unoobj/afmtuno.cxx   |   88 +---
 sc/source/ui/unoobj/cellsuno.cxx  |4 
 sc/source/ui/view/cellsh3.cxx |4 
 8 files changed, 162 insertions(+), 180 deletions(-)

New commits:
commit 0e4b36269097f8865bdbc1b9d299a2776ae0cc06
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Jan 11 10:26:41 2012 +0100

ScGlobal::GetAutoFormat not always required to create fresh instance.

...at least in ~ScAutoFormatObj it appears unnecessary and can lead to
crashes during Desktop::DeregisterServices (when ScGlobal::ppRscString
is already null and ScAutoFormat ctor calls ScGlobal::GetRscString).

Therefore split GetAutoFormat in two, GetOrCreateAutoFormat for cases
that probably need a non-null return and GetAutoFormat for those that
are OK with a null return.

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index a810400..ac10094 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -562,6 +562,7 @@ public:
 SC_DLLPUBLIC static const SvxSearchItemGetSearchItem();
 SC_DLLPUBLIC static voidSetSearchItem( const 
SvxSearchItem rNew );
 SC_DLLPUBLIC static ScAutoFormat*   GetAutoFormat();
+SC_DLLPUBLIC static ScAutoFormat*   GetOrCreateAutoFormat();
 static void ClearAutoFormat(); //BugId 54209
 static FuncCollection*  GetFuncCollection();
 SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection();
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 6de3782..c43a853 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -299,6 +299,11 @@ void ScGlobal::ClearAutoFormat()
 
 ScAutoFormat* ScGlobal::GetAutoFormat()
 {
+return pAutoFormat;
+}
+
+ScAutoFormat* ScGlobal::GetOrCreateAutoFormat()
+{
 if ( !pAutoFormat )
 {
 pAutoFormat = new ScAutoFormat;
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 9b38214..bc99c5c 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1592,14 +1592,10 @@ void ScTable::Fill( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
 void ScTable::AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, 
SCROW nEndRow,
 const ScPatternAttr rAttr, sal_uInt16 
nFormatNo)
 {
-ScAutoFormat* pAutoFormat = ScGlobal::GetAutoFormat();
-if (pAutoFormat)
+ScAutoFormatData* pData = (*ScGlobal::GetOrCreateAutoFormat())[nFormatNo];
+if (pData)
 {
-ScAutoFormatData* pData = (*pAutoFormat)[nFormatNo];
-if (pData)
-{
-ApplyPatternArea(nStartCol, nStartRow, nEndCol, nEndRow, rAttr);
-}
+ApplyPatternArea(nStartCol, nStartRow, nEndCol, nEndRow, rAttr);
 }
 }
 
@@ -1608,140 +1604,136 @@ void ScTable::AutoFormat( SCCOL nStartCol, SCROW 
nStartRow, SCCOL nEndCol, SCROW
 {
 if (ValidColRow(nStartCol, nStartRow)  ValidColRow(nEndCol, nEndRow))
 {
-ScAutoFormat* pAutoFormat = ScGlobal::GetAutoFormat();
-if (pAutoFormat)
+ScAutoFormatData* pData = 
(*ScGlobal::GetOrCreateAutoFormat())[nFormatNo];
+if (pData)
 {
-ScAutoFormatData* pData = (*pAutoFormat)[nFormatNo];
-if (pData)
+ScPatternAttr* pPatternAttrs[16];
+for (sal_uInt8 i = 0; i  16; ++i)
+{
+pPatternAttrs[i] = new ScPatternAttr(pDocument-GetPool());
+pData-FillToItemSet(i, pPatternAttrs[i]-GetItemSet(), 
*pDocument);
+}
+
+SCCOL nCol = nStartCol;
+SCROW nRow = nStartRow;
+sal_uInt16 nIndex = 0;
+// Linke obere Ecke
+AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], 
nFormatNo);
+// Linke Spalte
+if (pData-IsEqualData(4, 8))
+AutoFormatArea(nStartCol, nStartRow + 1, nStartCol, nEndRow - 
1, *pPatternAttrs[4], nFormatNo);
+else
 {
-ScPatternAttr* pPatternAttrs[16];
-for (sal_uInt8 i = 0; i  16; ++i)
+nIndex = 4;
+for (nRow = nStartRow + 1; nRow  nEndRow; nRow++)
 {
-pPatternAttrs[i] = new ScPatternAttr(pDocument-GetPool());
-pData-FillToItemSet(i, pPatternAttrs[i]-GetItemSet(), 
*pDocument);
+AutoFormatArea(nCol, nRow, nCol, nRow, 
*pPatternAttrs[nIndex], nFormatNo);
+if (nIndex == 4)
+nIndex = 8;
+else
+nIndex = 4;
 }
-
-SCCOL nCol = 

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

2012-01-11 Thread Kohei Yoshida
 sc/inc/dpobject.hxx  |8 ++-
 sc/source/core/data/dpobject.cxx |  100 +++
 2 files changed, 99 insertions(+), 9 deletions(-)

New commits:
commit e33702442a22a72f96a093fbfdf8bfac217f416f
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Wed Jan 11 15:24:52 2012 -0500

fdo#44661: Properly update range keys for pivot cache.

When the internal data source range gets modified, we should also
update the affected range keys that are used to look up pivot caches.

Otherwise we'll end up creating a brand new cache, without removing
the old one that's no longer referenced.

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index cc73fcb..db8ea92 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -259,12 +259,18 @@ public:
 class SheetCaches
 {
 friend class ScDPCollection;
-typedef ::boost::ptr_mapScRange, ScDPCache CachesType;
+typedef boost::ptr_mapsize_t, ScDPCache CachesType;
+typedef std::vectorScRange RangeIndexType;
 CachesType maCaches;
+RangeIndexType maRanges;
 ScDocument* mpDoc;
 public:
 SheetCaches(ScDocument* pDoc);
 const ScDPCache* getCache(const ScRange rRange);
+
+void updateReference(
+UpdateRefMode eMode, const ScRange r, SCsCOL nDx, SCsROW nDy, 
SCsTAB nDz);
+
 private:
 void removeCache(const ScRange rRange);
 };
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 51be02d..b0bbace 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2459,27 +2459,108 @@ uno::Referencesheet::XDimensionsSupplier 
ScDPObject::CreateSource( const ScDPS
 
 ScDPCollection::SheetCaches::SheetCaches(ScDocument* pDoc) : mpDoc(pDoc) {}
 
+namespace {
+
+struct FindInvalidRange : public std::unary_functionScRange, bool
+{
+bool operator() (const ScRange r) const
+{
+return !r.IsValid();
+}
+};
+
+}
+
 const ScDPCache* ScDPCollection::SheetCaches::getCache(const ScRange rRange)
 {
-CachesType::const_iterator itr = maCaches.find(rRange);
-if (itr != maCaches.end())
-// already cached.
-return itr-second;
+RangeIndexType::iterator it = std::find(maRanges.begin(), maRanges.end(), 
rRange);
+if (it != maRanges.end())
+{
+// Already cached.
+size_t nIndex = std::distance(maRanges.begin(), it);
+CachesType::iterator itCache = maCaches.find(nIndex);
+if (itCache == maCaches.end())
+// cache pool and index pool out-of-sync !!!
+return NULL;
 
+return itCache-second;
+}
+
+// Not cached.  Create a new cache.
 SAL_WNODEPRECATED_DECLARATIONS_PUSH
 ::std::auto_ptrScDPCache pCache(new ScDPCache(mpDoc));
 SAL_WNODEPRECATED_DECLARATIONS_POP
 pCache-InitFromDoc(mpDoc, rRange);
+
+// Get the smallest available range index.
+it = std::find_if(maRanges.begin(), maRanges.end(), FindInvalidRange());
+
+size_t nIndex = maRanges.size();
+if (it == maRanges.end())
+{
+// All range indices are valid.  Append a new index.
+maRanges.push_back(rRange);
+}
+else
+{
+// Slot with invalid range.  Re-use this slot.
+*it = rRange;
+nIndex = std::distance(maRanges.begin(), it);
+}
+
 const ScDPCache* p = pCache.get();
-maCaches.insert(rRange, pCache);
+maCaches.insert(nIndex, pCache);
 return p;
 }
 
+void ScDPCollection::SheetCaches::updateReference(
+UpdateRefMode eMode, const ScRange r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz)
+{
+if (maRanges.empty())
+// No caches.
+return;
+
+RangeIndexType::iterator it = maRanges.begin(), itEnd = maRanges.end();
+for (; it != itEnd; ++it)
+{
+const ScRange rKeyRange = *it;
+SCCOL nCol1 = rKeyRange.aStart.Col();
+SCROW nRow1 = rKeyRange.aStart.Row();
+SCTAB nTab1 = rKeyRange.aStart.Tab();
+SCCOL nCol2 = rKeyRange.aEnd.Col();
+SCROW nRow2 = rKeyRange.aEnd.Row();
+SCTAB nTab2 = rKeyRange.aEnd.Tab();
+
+ScRefUpdateRes eRes = ScRefUpdate::Update(
+mpDoc, eMode,
+r.aStart.Col(), r.aStart.Row(), r.aStart.Tab(),
+r.aEnd.Col(), r.aEnd.Row(), r.aEnd.Tab(), nDx, nDy, nDz,
+nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
+
+if (eRes != UR_NOTHING)
+{
+// range updated.
+ScRange aNew(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
+*it = aNew;
+}
+}
+}
+
 void ScDPCollection::SheetCaches::removeCache(const ScRange rRange)
 {
-CachesType::iterator itr = maCaches.find(rRange);
-if (itr != maCaches.end())
-maCaches.erase(itr);
+RangeIndexType::iterator it = std::find(maRanges.begin(), maRanges.end(), 
rRange);
+if (it == maRanges.end())
+// Not cached.  Nothing to do.
+return;
+
+  

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

2012-01-09 Thread Kohei Yoshida
 sc/inc/dbdata.hxx|1 +
 sc/inc/document.hxx  |2 --
 sc/source/core/data/documen3.cxx |8 
 sc/source/core/data/table2.cxx   |3 ++-
 sc/source/core/tool/dbdata.cxx   |   17 -
 5 files changed, 19 insertions(+), 12 deletions(-)

New commits:
commit 0d6e8c35133c10b3b4e0ef69bbca51ac7506b5d2
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Mon Jan 9 12:03:48 2012 -0500

fdo#44545: Skip filtered cells during auto-fill.

Regression from 3.4.5.

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 1aab271..cef02e1 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -213,6 +213,7 @@ 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/inc/document.hxx b/sc/inc/document.hxx
index 8e41fea..2d232e7 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -492,8 +492,6 @@ public:
 ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool 
bStartOnly = false);
 const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2) const;
 ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, 
SCROW nRow2);
-const ScDBData* GetFilterDBAtTable(SCTAB nTab) const;
-
 
 SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange rBlock, 
rtl::OUString* pName=NULL ) const;
 
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 63d926a..66973de 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -311,14 +311,6 @@ ScDBData* ScDocument::GetDBAtArea(SCTAB nTab, SCCOL nCol1, 
SCROW nRow1, SCCOL nC
 return NULL;
 }
 
-const ScDBData* ScDocument::GetFilterDBAtTable(SCTAB nTab) const
-{
-if (pDBCollection)
-return pDBCollection-GetFilterDBAtTable(nTab);
-else
-return NULL;
-}
-
 ScDPCollection* ScDocument::GetDPCollection()
 {
 if (!pDPCollection)
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 2b5fbed..2c40a5c 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2652,7 +2652,8 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool 
bShow)
 bool ScTable::IsDataFiltered() const
 {
 bool bAnyQuery = false;
-const ScDBData* pDBData = pDocument-GetFilterDBAtTable(nTab);
+const ScDBCollection* pDBs = pDocument-GetDBCollection();
+const ScDBData* pDBData = pDBs-GetFilterDBAtTable(nTab);
 if ( pDBData )
 {
 ScQueryParam aParam;
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 288fbac..c612d32 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -808,6 +808,13 @@ 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);
@@ -972,7 +979,15 @@ const ScDBData* ScDBCollection::GetFilterDBAtTable(SCTAB 
nTab) const
 NamedDBs::DBsType::const_iterator itr = find_if(
 maNamedDBs.begin(), maNamedDBs.end(), FindFilterDBByTable(nTab));
 
-return itr == maNamedDBs.end() ? NULL : (*itr);
+const ScDBData* pData = itr == maNamedDBs.end() ? NULL : (*itr);
+if (pData)
+return pData;
+
+pData = pDoc-GetAnonymousDBData(nTab);
+if (pData)
+return pData;
+
+return getAnonDBs().findByTable(nTab);
 }
 
 void ScDBCollection::DeleteOnTab( SCTAB nTab )
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-01-07 Thread Kohei Yoshida
 sc/inc/userdat.hxx   |2 +-
 sc/source/core/data/drwlayer.cxx |5 +
 sc/source/core/tool/detfunc.cxx  |5 +++--
 3 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 08708fcc39f300c477aad581e5bdc42e5931dd8c
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Sat Jan 7 20:56:15 2012 -0500

Mark detective arrows clearly since we need to treat them differently.

Otherwise it gets confused with normal arrow objects during re-
positioning.

diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx
index ed6adc2..e0463b3 100644
--- a/sc/inc/userdat.hxx
+++ b/sc/inc/userdat.hxx
@@ -59,7 +59,7 @@ public:
 class ScDrawObjData : public SdrObjUserData
 {
 public:
-enum Type { CellNote, ValidationCircle, DrawingObject };
+enum Type { CellNote, ValidationCircle, DetectiveArrow, DrawingObject };
 
 ScAddress   maStart;
 ScAddress   maEnd;
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 087d510..cdbb95d 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -643,9 +643,6 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, 
ScDrawObjData rData, bool bNegati
 SCROW nRow2 = rData.maEnd.Row();
 SCTAB nTab2 = rData.maEnd.Tab();
 
-// detective arrow
-bool bArrow = pObj-IsPolyObj()  (pObj-GetPointCount() == 2);
-
 if (rData.meType == ScDrawObjData::ValidationCircle)
 {
 // Validation circle for detective.
@@ -675,7 +672,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, 
ScDrawObjData rData, bool bNegati
 pObj-SetLogicRect(rData.maLastRect);
 }
 }
-else if( bArrow )
+else if (rData.meType == ScDrawObjData::DetectiveArrow)
 {
 rData.maLastRect = pObj-GetLogicRect();
 basegfx::B2DPolygon aCalcPoly;
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index ebf9ef8..9c6d65f 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -545,16 +545,17 @@ sal_Bool ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW 
nRow,
 pPage-InsertObject( pArrow );
 pModel-AddCalcUndo( new SdrUndoInsertObj( *pArrow ) );
 
-ScDrawObjData* pData = ScDrawLayer::GetObjData( pArrow, sal_True );
+ScDrawObjData* pData = ScDrawLayer::GetObjData(pArrow, true);
 if (bFromOtherTab)
 pData-maStart.SetInvalid();
 else
 pData-maStart.Set( nRefStartCol, nRefStartRow, nTab);
 
 pData-maEnd.Set( nCol, nRow, nTab);
+pData-meType = ScDrawObjData::DetectiveArrow;
 
 Modified();
-return sal_True;
+return true;
 }
 
 sal_Bool ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-01-06 Thread Kohei Yoshida
 sc/inc/userdat.hxx   |4 +++-
 sc/source/core/data/drwlayer.cxx |   11 +--
 sc/source/core/data/postit.cxx   |2 +-
 sc/source/core/data/userdat.cxx  |2 +-
 sc/source/core/tool/detfunc.cxx  |1 +
 sc/source/ui/view/drawvie3.cxx   |2 +-
 6 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 248a6136b898389a5d3d351859591b2de458ce90
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Fri Jan 6 16:24:07 2012 -0500

Fix re-calculation of the position of circular drawing objects.

Cell-anchored circular drawing objects would get distorted whenever
its bounding rectangle changes, either via insertion / removal of
columns / rows, or changing the row height / column width.

This commit fixes it by differentiating the validation circles, which
needs its own re-calc algorithm, from the normal circular drawing
objects.

diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx
index 259e99d..ed6adc2 100644
--- a/sc/inc/userdat.hxx
+++ b/sc/inc/userdat.hxx
@@ -59,11 +59,13 @@ public:
 class ScDrawObjData : public SdrObjUserData
 {
 public:
+enum Type { CellNote, ValidationCircle, DrawingObject };
+
 ScAddress   maStart;
 ScAddress   maEnd;
 Point   maStartOffset;
 Point   maEndOffset;
-boolmbNote;
+TypemeType;
 Rectangle   maLastRect;
 
 explicitScDrawObjData();
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 2e2d00a..91820f4 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -610,7 +610,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, 
ScDrawObjData rData, bool bNegati
 if( !pDoc )
 return;
 
-if( rData.mbNote )
+if (rData.meType == ScDrawObjData::CellNote)
 {
 OSL_ENSURE( rData.maStart.IsValid(), ScDrawLayer::RecalcPos - invalid 
position for cell note );
 /*  #i109372# On insert/remove rows/columns/cells: Updating the caption
@@ -636,13 +636,12 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, 
ScDrawObjData rData, bool bNegati
 SCROW nRow2 = rData.maEnd.Row();
 SCTAB nTab2 = rData.maEnd.Tab();
 
-// validation circle
-bool bCircle = pObj-ISA( SdrCircObj );
 // detective arrow
 bool bArrow = pObj-IsPolyObj()  (pObj-GetPointCount() == 2);
 
-if( bCircle )
+if (rData.meType == ScDrawObjData::ValidationCircle)
 {
+// Validation circle for detective.
 rData.maLastRect = pObj-GetLogicRect();
 
 Point aPos( pDoc-GetColOffset( nCol1, nTab1 ), pDoc-GetRowOffset( 
nRow1, nTab1 ) );
@@ -1835,13 +1834,13 @@ ScDrawObjData* ScDrawLayer::GetObjDataTab( SdrObject* 
pObj, SCTAB nTab )
 bool ScDrawLayer::IsNoteCaption( SdrObject* pObj )
 {
 ScDrawObjData* pData = pObj ? GetObjData( pObj ) : 0;
-return pData  pData-mbNote;
+return pData  pData-meType == ScDrawObjData::CellNote;
 }
 
 ScDrawObjData* ScDrawLayer::GetNoteCaptionData( SdrObject* pObj, SCTAB nTab )
 {
 ScDrawObjData* pData = pObj ? GetObjDataTab( pObj, nTab ) : 0;
-return (pData  pData-mbNote) ? pData : 0;
+return (pData  pData-meType == ScDrawObjData::CellNote) ? pData : 0;
 }
 
 ScIMapInfo* ScDrawLayer::GetIMapInfo( SdrObject* pObj )
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index a8881c0..04001c3 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -109,7 +109,7 @@ void ScCaptionUtil::SetCaptionUserData( SdrCaptionObj 
rCaption, const ScAddress
 ScDrawObjData* pObjData = ScDrawLayer::GetObjData( rCaption, true );
 OSL_ENSURE( pObjData, ScCaptionUtil::SetCaptionUserData - missing drawing 
object user data );
 pObjData-maStart = rPos;
-pObjData-mbNote = true;
+pObjData-meType = ScDrawObjData::CellNote;
 }
 
 void ScCaptionUtil::SetDefaultItems( SdrCaptionObj rCaption, ScDocument rDoc 
)
diff --git a/sc/source/core/data/userdat.cxx b/sc/source/core/data/userdat.cxx
index 2b2db80..6947634 100644
--- a/sc/source/core/data/userdat.cxx
+++ b/sc/source/core/data/userdat.cxx
@@ -70,7 +70,7 @@ ScDrawObjData::ScDrawObjData() :
 SdrObjUserData( SC_DRAWLAYER, SC_UD_OBJDATA, 0 ),
 maStart( ScAddress::INITIALIZE_INVALID ),
 maEnd( ScAddress::INITIALIZE_INVALID ),
-mbNote( false )
+meType( DrawingObject )
 {
 }
 
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 567ba49..ebf9ef8 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -681,6 +681,7 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, 
ScDetectiveData rData
 ScDrawObjData* pData = ScDrawLayer::GetObjData( pCircle, sal_True );
 pData-maStart.Set( nCol, nRow, nTab);
 pData-maEnd.SetInvalid();
+pData-meType = ScDrawObjData::ValidationCircle;
 
 Modified();
 }
diff --git a/sc/source/ui/view/drawvie3.cxx 

  1   2   >