[Libreoffice-commits] .: 5 commits - sc/inc sc/Module_sc.mk sc/qa sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Oct 14 19:56:36 PDT 2012
sc/Module_sc.mk | 1
sc/inc/postit.hxx | 5 +-
sc/qa/unit/ucalc.cxx | 42 ++++++++++++++++++++++
sc/source/core/data/postit.cxx | 7 +--
sc/source/core/data/table2.cxx | 6 +--
sc/source/ui/condformat/condformatdlgentry.cxx | 10 ++++-
sc/source/ui/inc/anyrefdg.hxx | 24 ++++++-------
sc/source/ui/miscdlgs/anyrefdg.cxx | 46 ++++++++++++-------------
8 files changed, 95 insertions(+), 46 deletions(-)
New commits:
commit aa7500f2231c383e4fd49e94757faccacdde1185
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Oct 13 08:42:33 2012 +0200
add a unit test for removing rows/columns with comments
Change-Id: I91d9abdc61f75ba080e092dc9b4e18bdb89b3705
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 8eef410..a5e3a07 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -225,6 +225,8 @@ public:
void testFindAreaPosColRight();
void testSort();
void testSortWithFormulaRefs();
+ void testDeleteRow();
+ void testDeleteCol();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testCollator);
@@ -275,6 +277,8 @@ public:
CPPUNIT_TEST(testFindAreaPosColRight);
CPPUNIT_TEST(testSort);
CPPUNIT_TEST(testSortWithFormulaRefs);
+ CPPUNIT_TEST(testDeleteRow);
+ CPPUNIT_TEST(testDeleteCol);
CPPUNIT_TEST_SUITE_END();
private:
@@ -5030,6 +5034,44 @@ void Test::testSort()
pDoc->DeleteTab(0);
}
+void Test::testDeleteRow()
+{
+ ScDocument* pDoc = m_xDocShRef->GetDocument();
+ rtl::OUString aSheet1("Sheet1");
+ pDoc->InsertTab(0, aSheet1);
+
+ rtl::OUString aHello("Hello");
+ rtl::OUString aJimBob("Jim Bob");
+ ScAddress rAddr(1, 1, 0);
+ ScPostIt* pNote = m_pDoc->GetNotes(rAddr.Tab())->GetOrCreateNote(rAddr);
+ pNote->SetText(rAddr, aHello);
+ pNote->SetAuthor(aJimBob);
+
+ pDoc->DeleteRow(0, 0, MAXCOL, 0, 1, 1);
+
+ CPPUNIT_ASSERT(m_pDoc->GetNotes(0)->empty());
+ pDoc->DeleteTab(0);
+}
+
+void Test::testDeleteCol()
+{
+ ScDocument* pDoc = m_xDocShRef->GetDocument();
+ rtl::OUString aSheet1("Sheet1");
+ pDoc->InsertTab(0, aSheet1);
+
+ rtl::OUString aHello("Hello");
+ rtl::OUString aJimBob("Jim Bob");
+ ScAddress rAddr(1, 1, 0);
+ ScPostIt* pNote = m_pDoc->GetNotes(rAddr.Tab())->GetOrCreateNote(rAddr);
+ pNote->SetText(rAddr, aHello);
+ pNote->SetAuthor(aJimBob);
+
+ pDoc->DeleteCol(0, 0, MAXROW, 0, 1, 1);
+
+ CPPUNIT_ASSERT(m_pDoc->GetNotes(0)->empty());
+ pDoc->DeleteTab(0);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
commit 8fb84ee62409dec8eb02982c9cf78fb42bf1747e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Oct 13 12:28:36 2012 +0200
sal_Bool to bool in anyrefdg.[ch]xx
Change-Id: I4efa09c0185e7825d5b705ca0171f52b8aae17df
diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index 247edc0..8b66f68 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -62,7 +62,7 @@ class ScFormulaReferenceHelper
SfxBindings* m_pBindings;
::std::auto_ptr<Accelerator>
pAccel; // for Enter/Escape
- sal_Bool* pHiddenMarks; // Mark field for hidden Controls
+ bool* pHiddenMarks; // Mark field for hidden Controls
SCTAB nRefTab; // used for ShowReference
String sOldDialogText; // Original title of the dialog window
@@ -72,9 +72,9 @@ class ScFormulaReferenceHelper
Point aOldButtonPos; // Original position of the button
Window* mpOldEditParent; // Original parent of the edit field and the button
- sal_Bool bEnableColorRef;
- sal_Bool bHighLightRef;
- sal_Bool bAccInserted;
+ bool bEnableColorRef;
+ bool bHighLightRef;
+ bool bAccInserted;
DECL_LINK( AccelSelectHdl, Accelerator* );
@@ -89,25 +89,25 @@ public:
void ShowReference( const XubString& rStr );
void ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
- void HideReference( sal_Bool bDoneRefMode = sal_True );
+ void HideReference( bool bDoneRefMode = true );
void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
- void RefInputDone( sal_Bool bForced = false );
+ void RefInputDone( bool bForced = false );
void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
inline void SetWindow(Window* _pWindow) { m_pWindow = _pWindow; }
- sal_Bool DoClose( sal_uInt16 nId );
- void SetDispatcherLock( sal_Bool bLock );
- void EnableSpreadsheets( sal_Bool bFlag = sal_True, sal_Bool bChildren = sal_True );
+ bool DoClose( sal_uInt16 nId );
+ void SetDispatcherLock( bool bLock );
+ void EnableSpreadsheets( bool bFlag = true, bool bChildren = true );
void ViewShellChanged( ScTabViewShell* pScViewShell );
- static void enableInput(sal_Bool _bInput);
+ static void enableInput(bool _bInput);
protected:
Window * GetWindow(){ return m_pWindow; }
public:
bool CanInputStart( const formula::RefEdit *pEdit ){ return !!pEdit; }
- bool CanInputDone( sal_Bool bForced ){ return pRefEdit && (bForced || !pRefBtn); }
+ bool CanInputDone( bool bForced ){ return pRefEdit && (bForced || !pRefBtn); }
};
//============================================================================
@@ -139,7 +139,7 @@ private:
protected:
virtual sal_Bool DoClose( sal_uInt16 nId );
- void SetDispatcherLock( sal_Bool bLock );
+ void SetDispatcherLock( bool bLock );
//Overwrite TWindow will implemented by ScRefHdlrImplBase
//virtual long PreNotify( NotifyEvent& rNEvt );
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 8ebb1c3..3b4e9a4 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -76,14 +76,14 @@ ScFormulaReferenceHelper::~ScFormulaReferenceHelper()
// common cleanup for ScAnyRefDlg and ScFormulaDlg is done here
HideReference();
- enableInput( sal_True );
+ enableInput( true );
ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
if ( pInputHdl )
pInputHdl->ResetDelayTimer(); // stop the timer for disabling the input line
}
// -----------------------------------------------------------------------------
-void ScFormulaReferenceHelper::enableInput( sal_Bool bEnable )
+void ScFormulaReferenceHelper::enableInput( bool bEnable )
{
TypeId aType(TYPE(ScDocShell));
ScDocShell* pDocShell = (ScDocShell*)SfxObjectShell::GetFirst(&aType);
@@ -105,8 +105,8 @@ void ScFormulaReferenceHelper::enableInput( sal_Bool bEnable )
Window *pParent=pWin->GetParent();
if(pParent)
{
- pParent->EnableInput(bEnable,sal_True /* sal_False */);
- if(sal_True /*bChildren*/)
+ pParent->EnableInput(bEnable,true /* sal_False */);
+ if(true /*bChildren*/)
pViewSh->EnableRefInput(bEnable);
}
}
@@ -123,7 +123,7 @@ void ScFormulaReferenceHelper::ShowSimpleReference( const XubString& rStr )
{
if( bEnableColorRef )
{
- bHighLightRef=sal_True;
+ bHighLightRef=true;
ScViewData* pViewData=ScDocShell::GetViewData();
if ( pViewData )
{
@@ -183,7 +183,7 @@ void ScFormulaReferenceHelper::ShowFormulaReference( const XubString& rStr )
{
if( /*!pRefEdit &&*/ bEnableColorRef)
{
- bHighLightRef=sal_True;
+ bHighLightRef=true;
ScViewData* pViewData=ScDocShell::GetViewData();
if ( pViewData && pRefComp.get() )
{
@@ -208,7 +208,7 @@ void ScFormulaReferenceHelper::ShowFormulaReference( const XubString& rStr )
while(pToken!=NULL)
{
- sal_Bool bDoubleRef=(pToken->GetType()==formula::svDoubleRef);
+ bool bDoubleRef=(pToken->GetType()==formula::svDoubleRef);
if(pToken->GetType()==formula::svSingleRef || bDoubleRef)
@@ -240,7 +240,7 @@ void ScFormulaReferenceHelper::ShowFormulaReference( const XubString& rStr )
}
}
// -----------------------------------------------------------------------------
-void ScFormulaReferenceHelper::HideReference( sal_Bool bDoneRefMode )
+void ScFormulaReferenceHelper::HideReference( bool bDoneRefMode )
{
ScViewData* pViewData=ScDocShell::GetViewData();
@@ -310,7 +310,7 @@ void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit, formula::R
pViewShell->MoveCursorAbs( pRange->aStart.Col(),
pRange->aStart.Row(), SC_FOLLOW_JUMP, false, false );
pViewShell->MoveCursorAbs( pRange->aEnd.Col(),
- pRange->aEnd.Row(), SC_FOLLOW_JUMP, sal_True, false );
+ pRange->aEnd.Row(), SC_FOLLOW_JUMP, true, false );
m_pDlg->SetReference( *pRange, pDoc );
}
}
@@ -333,7 +333,7 @@ void ScFormulaReferenceHelper::Init()
pRefCell.reset( new ScFormulaCell( pDoc, aCursorPos, rStrExp ) );
pRefComp.reset( new ScCompiler( pDoc, aCursorPos) );
pRefComp->SetGrammar( pDoc->GetGrammar() );
- pRefComp->SetCompileForFAP(sal_True);
+ pRefComp->SetCompileForFAP(true);
nRefTab = nTab;
}
@@ -350,13 +350,13 @@ IMPL_LINK( ScFormulaReferenceHelper, AccelSelectHdl, Accelerator *, pSelAccel )
case KEY_ESCAPE:
if( pRefEdit )
pRefEdit->GrabFocus();
- m_pDlg->RefInputDone( sal_True );
+ m_pDlg->RefInputDone( true );
break;
}
- return sal_True;
+ return true;
}
//----------------------------------------------------------------------------
-void ScFormulaReferenceHelper::RefInputDone( sal_Bool bForced )
+void ScFormulaReferenceHelper::RefInputDone( bool bForced )
{
if ( CanInputDone( bForced ) )
{
@@ -428,7 +428,7 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::
// Alle Elemente ausser EditCell und Button verstecken
sal_uInt16 nChildren = m_pWindow->GetChildCount();
- pHiddenMarks = new sal_Bool [nChildren];
+ pHiddenMarks = new bool [nChildren];
for (sal_uInt16 i = 0; i < nChildren; i++)
{
pHiddenMarks[i] = false;
@@ -442,7 +442,7 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::
; // do nothing
else if (pWin->IsVisible())
{
- pHiddenMarks[i] = sal_True;
+ pHiddenMarks[i] = true;
pWin->Hide();
}
}
@@ -498,11 +498,11 @@ void ScFormulaReferenceHelper::ToggleCollapsed( formula::RefEdit* pEdit, formula
if( pRefEdit == pEdit ) // is this the active ref edit field?
{
pRefEdit->GrabFocus(); // before RefInputDone()
- m_pDlg->RefInputDone( sal_True ); // finish ref input
+ m_pDlg->RefInputDone( true ); // finish ref input
}
else
{
- m_pDlg->RefInputDone( sal_True ); // another active ref edit?
+ m_pDlg->RefInputDone( true ); // another active ref edit?
m_pDlg->RefInputStart( pEdit, pButton ); // start ref input
// pRefEdit might differ from pEdit after RefInputStart() (i.e. ScFormulaDlg)
if( pRefEdit )
@@ -511,7 +511,7 @@ void ScFormulaReferenceHelper::ToggleCollapsed( formula::RefEdit* pEdit, formula
}
}
// -----------------------------------------------------------------------------
-sal_Bool ScFormulaReferenceHelper::DoClose( sal_uInt16 nId )
+bool ScFormulaReferenceHelper::DoClose( sal_uInt16 nId )
{
SfxApplication* pSfxApp = SFX_APP();
@@ -545,11 +545,11 @@ sal_Bool ScFormulaReferenceHelper::DoClose( sal_uInt16 nId )
ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell();
if ( pScViewShell )
- pScViewShell->UpdateInputHandler(sal_True);
+ pScViewShell->UpdateInputHandler(true);
- return sal_True;
+ return true;
}
-void ScFormulaReferenceHelper::SetDispatcherLock( sal_Bool bLock )
+void ScFormulaReferenceHelper::SetDispatcherLock( bool bLock )
{
// lock / unlock only the dispatchers of Calc documents
@@ -580,7 +580,7 @@ void ScFormulaReferenceHelper::ViewShellChanged(ScTabViewShell* /* pScViewShell
EnableSpreadsheets();
}
-void ScFormulaReferenceHelper::EnableSpreadsheets(sal_Bool bFlag, sal_Bool bChildren)
+void ScFormulaReferenceHelper::EnableSpreadsheets(bool bFlag, bool bChildren)
{
TypeId aType(TYPE(ScDocShell));
ScDocShell* pDocShell = (ScDocShell*)SfxObjectShell::GetFirst(&aType);
@@ -824,7 +824,7 @@ sal_Bool ScRefHandler::DoClose( sal_uInt16 nId )
return sal_True;
}
-void ScRefHandler::SetDispatcherLock( sal_Bool bLock )
+void ScRefHandler::SetDispatcherLock( bool bLock )
{
m_aHelper.SetDispatcherLock( bLock );
}
commit d342c9bebe446cb16285b203f207b4b215b5941a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Oct 13 12:11:45 2012 +0200
hide edit fields for duplicate and unique
Change-Id: Ib2d07a22393604ea11454de125849e9d0da430b8
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 1588bc4..75fec8c 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -910,12 +910,20 @@ IMPL_LINK( ScColorScale3FrmtEntry, EntryTypeHdl, ListBox*, pBox )
IMPL_LINK_NOARG( ScConditionFrmtEntry, ConditionTypeSelectHdl )
{
- if(maLbCondType.GetSelectEntryPos() == 6 || maLbCondType.GetSelectEntryPos() == 7)
+ sal_Int32 nSelectPos = maLbCondType.GetSelectEntryPos();
+ if(nSelectPos == 6 || nSelectPos == 7)
{
+ maEdVal1.Show();
maEdVal2.Show();
}
+ else if(nSelectPos == 8 || nSelectPos == 9)
+ {
+ maEdVal2.Hide();
+ maEdVal1.Hide();
+ }
else
{
+ maEdVal1.Show();
maEdVal2.Hide();
}
commit f8dada570ba03b6761a41a074063f2d306989232
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Oct 13 10:02:08 2012 +0200
fix memory leak in note handling
Change-Id: I55a7673aff8e23f59ccb99ea73a102df215ba599
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 649a6fc..2203364 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -44,7 +44,6 @@ endif
$(eval $(call gb_Module_add_check_targets,sc,\
CppunitTest_sc_ucalc \
- CppunitTest_sc_rangelst_test \
))
# Disabled to allow the check tinderbox execute the sd tests
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 0db2a9f..f9c2286 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -266,10 +266,11 @@ private:
typedef std::map<ScAddress2D, ScPostIt*> ScNoteMap;
ScNoteMap maNoteMap;
+ ScNotes(const ScNotes& rNotes);
+ ScNotes operator=(const ScNotes& rNotes);
ScDocument* mpDoc;
public:
ScNotes(ScDocument* pDoc);
- ScNotes(const ScNotes& rNotes);
~ScNotes();
typedef ScNoteMap::iterator iterator;
@@ -306,7 +307,7 @@ public:
void clear();
- ScNotes* clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab);
+ void clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab, ScNotes& rTarget);
void CopyFromClip(const ScNotes& maNotes, ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, SCTAB nTab, bool bCloneCaption);
void erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bForgetCaption = false);
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 97ab523..4f9c21a 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -1057,9 +1057,9 @@ void ScNotes::clear()
maNoteMap.clear();
}
-ScNotes* ScNotes::clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab)
+void ScNotes::clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab, ScNotes& rTarget)
{
- ScNotes* pNotes = new ScNotes(pDoc);
+ rTarget.clear();
for (ScNotes::iterator itr = maNoteMap.begin(); itr != maNoteMap.end(); ++itr)
{
SCCOL nCol = itr->first.first;
@@ -1067,10 +1067,9 @@ ScNotes* ScNotes::clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2)
{
- pNotes->insert(nCol, nRow, itr->second->Clone( ScAddress(nCol, nRow, nTab),*pDoc, ScAddress(nCol, nRow, nTab), bCloneNoteCaption));
+ rTarget.insert(nCol, nRow, itr->second->Clone( ScAddress(nCol, nRow, nTab), *pDoc, ScAddress(nCol, nRow, nTab), bCloneNoteCaption));
}
}
- return pNotes;
}
void ScNotes::CopyFromClip(const ScNotes& rNotes, ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, SCTAB nTab, bool bCloneCaption)
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 3da04e3..2a51d54 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -611,7 +611,7 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pTable->mpRangeName = new ScRangeName(*mpRangeName);
// notes
- pTable->maNotes = *maNotes.clone(pTable->pDocument, nCol1, nRow1, nCol2, nRow2, bCloneNoteCaptions, nTab);
+ maNotes.clone(pTable->pDocument, nCol1, nRow1, nCol2, nRow2, bCloneNoteCaptions, nTab, pTable->maNotes);
SCCOL i;
commit 262079b2df4fb42ab00b93e8d87b364cb38ce7ae
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Oct 13 08:41:35 2012 +0200
fix the problem in the right method
Change-Id: Ifedd563ad430cff957e148d81367139455d71686
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index d016c6b..3da04e3 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -377,7 +377,7 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
ScPostIt* pPostIt = itr->second;
++itr;
- if (nCol - nStartCol >= nStartCol)
+ if (nCol >= nStartCol)
{
aNotes.insert(nCol + nSize, nRow, pPostIt);
maNotes.ReleaseNote(nCol, nRow);
@@ -488,7 +488,7 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
if (nCol >= nStartCol)
{
- if(nCol > static_cast<SCCOL>(nSize))
+ if(nCol - nStartCol > static_cast<SCCOL>(nSize))
{
aNotes.insert(nCol - nSize, nRow, pPostIt);
maNotes.ReleaseNote(nCol, nRow);
More information about the Libreoffice-commits
mailing list