[Libreoffice-commits] core.git: 2 commits - sc/inc sc/Module_sc.mk sc/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Thu Apr 24 14:43:59 PDT 2014
sc/Module_sc.mk | 7 ----
sc/inc/globstr.hrc | 4 +-
sc/source/filter/inc/orcusinterface.hxx | 24 ++++++++++++++
sc/source/filter/orcus/interface.cxx | 33 +++++++++++++++++++-
sc/source/ui/docshell/docfunc.cxx | 40 +++++++++++++++++++++++-
sc/source/ui/inc/undoblk.hxx | 22 +++++++++++++
sc/source/ui/src/globstr.src | 5 +++
sc/source/ui/undo/undoblk.cxx | 52 ++++++++++++++++++++++++++++++++
8 files changed, 176 insertions(+), 11 deletions(-)
New commits:
commit f2431c944376433219eb7eb704e9b21589f201f5
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Apr 23 05:23:50 2014 +0200
add undo action for conditional formatting, cp#1000050, fdo#77381
Change-Id: I11db1e5824077135c4352ae43cc0e8d139244268
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 8456944..0b2a660 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -692,7 +692,9 @@
#define STR_PRINT_PREVIEW_NODATA 529
#define STR_PRINT_PREVIEW_EMPTY_RANGE 530
-#define SC_GLOBSTR_STR_COUNT 531 /**< the count of permanently resident strings */
+#define STR_UNDO_CONDFORMAT 531
+
+#define SC_GLOBSTR_STR_COUNT 532 /**< the count of permanently resident strings */
#endif
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 5950a9d..9a9daa3 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5302,6 +5302,31 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
if(pDoc->IsTabProtected(nTab))
return;
+ bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument* pUndoDoc = NULL;
+ ScRange aCombinedRange = rRanges.Combine();
+ ScRange aCompleteRange;
+ if(bUndo)
+ {
+ pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
+ pUndoDoc->InitUndo( pDoc, nTab, nTab );
+
+ if(pFormat)
+ {
+ aCompleteRange = aCombinedRange;
+ }
+ if(nOldFormat)
+ {
+ ScConditionalFormat* pOldFormat = pDoc->GetCondFormList(nTab)->GetFormat(nOldFormat);
+ if(pOldFormat)
+ aCompleteRange.ExtendTo(pOldFormat->GetRange().Combine());
+ }
+
+ pDoc->CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
+ aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab,
+ IDF_ALL, false, pUndoDoc );
+ }
+
boost::scoped_ptr<ScRange> pRepaintRange;
if(nOldFormat)
{
@@ -5318,9 +5343,9 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
if(pFormat)
{
if(pRepaintRange)
- pRepaintRange->ExtendTo(rRanges.Combine());
+ pRepaintRange->ExtendTo(aCombinedRange);
else
- pRepaintRange.reset(new ScRange(rRanges.Combine()));
+ pRepaintRange.reset(new ScRange(aCombinedRange));
sal_uLong nIndex = pDoc->AddCondFormat(pFormat, nTab);
@@ -5328,6 +5353,17 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
pDoc->SetStreamValid(nTab, false);
}
+ if(bUndo)
+ {
+ ScDocument* pRedoDoc = new ScDocument(SCDOCMODE_UNDO);
+ pRedoDoc->InitUndo( pDoc, nTab, nTab );
+ pDoc->CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
+ aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab,
+ IDF_ALL, false, pRedoDoc );
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoConditionalFormat(&rDocShell, pUndoDoc, pRedoDoc, aCompleteRange));
+ }
+
if(pRepaintRange)
rDocShell.PostPaint(*pRepaintRange, PAINT_GRID);
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index d619e5b..40af6cc 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -636,6 +636,28 @@ private:
void DoChange( ScDocument* pSrcDoc ) const;
};
+class ScUndoConditionalFormat : public ScSimpleUndo
+{
+public:
+ TYPEINFO_OVERRIDE();
+ ScUndoConditionalFormat( ScDocShell* pNewDocShell,
+ ScDocument* pUndoDoc, ScDocument* pRedoDoc, const ScRange& rRange);
+ virtual ~ScUndoConditionalFormat();
+
+ virtual void Undo() SAL_OVERRIDE;
+ virtual void Redo() SAL_OVERRIDE;
+ virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
+
+ virtual OUString GetComment() const SAL_OVERRIDE;
+
+private:
+ void DoChange(ScDocument* pDoc);
+ boost::scoped_ptr<ScDocument> mpUndoDoc;
+ boost::scoped_ptr<ScDocument> mpRedoDoc;
+ ScRange maRange;
+};
+
class ScUndoUseScenario: public ScSimpleUndo
{
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index b55ae11..3d167fd 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -2071,6 +2071,11 @@ Resource RID_GLOBSTR
{
Text [ en-US ] = "Print Range Empty";
};
+
+ String STR_UNDO_CONDFORMAT
+ {
+ Text [ en-US ] = "Conditional Format";
+ };
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 8496fc2..4472e94 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -61,6 +61,7 @@ TYPEINIT1(ScUndoCut, ScBlockUndo);
TYPEINIT1(ScUndoPaste, SfxUndoAction);
TYPEINIT1(ScUndoDragDrop, SfxUndoAction);
TYPEINIT1(ScUndoListNames, SfxUndoAction);
+TYPEINIT1(ScUndoConditionalFormat, SfxUndoAction);
TYPEINIT1(ScUndoUseScenario, SfxUndoAction);
TYPEINIT1(ScUndoSelectionStyle, SfxUndoAction);
TYPEINIT1(ScUndoEnterMatrix, ScBlockUndo);
@@ -1430,6 +1431,57 @@ bool ScUndoListNames::CanRepeat(SfxRepeatTarget& rTarget) const
return rTarget.ISA(ScTabViewTarget);
}
+ScUndoConditionalFormat::ScUndoConditionalFormat(ScDocShell* pNewDocShell,
+ ScDocument* pUndoDoc, ScDocument* pRedoDoc, const ScRange& rRange):
+ ScSimpleUndo( pNewDocShell ),
+ mpUndoDoc(pUndoDoc),
+ mpRedoDoc(pRedoDoc),
+ maRange(rRange)
+{
+}
+
+ScUndoConditionalFormat::~ScUndoConditionalFormat()
+{
+}
+
+OUString ScUndoConditionalFormat::GetComment() const
+{
+ return ScGlobal::GetRscString( STR_UNDO_CONDFORMAT );
+}
+
+void ScUndoConditionalFormat::Undo()
+{
+ DoChange(mpUndoDoc.get());
+}
+
+void ScUndoConditionalFormat::Redo()
+{
+ DoChange(mpRedoDoc.get());
+}
+
+void ScUndoConditionalFormat::DoChange(ScDocument* pSrcDoc)
+{
+ ScDocument* pDoc = pDocShell->GetDocument();
+
+ pDoc->DeleteAreaTab( maRange, IDF_ALL );
+ pSrcDoc->CopyToDocument( maRange, IDF_ALL, false, pDoc );
+ pDocShell->PostPaint( maRange, PAINT_GRID );
+ pDocShell->PostDataChanged();
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (pViewShell)
+ pViewShell->CellContentChanged();
+}
+
+void ScUndoConditionalFormat::Repeat(SfxRepeatTarget& )
+{
+}
+
+bool ScUndoConditionalFormat::CanRepeat(SfxRepeatTarget& ) const
+{
+ return false;
+}
+
+
ScUndoUseScenario::ScUndoUseScenario( ScDocShell* pNewDocShell,
const ScMarkData& rMark,
/*C*/ const ScArea& rDestArea,
commit 96475ada3fcf026ae7833824a056b642c1bd1864
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Apr 23 02:35:25 2014 +0200
orcus autofilter import, implement the interface
only empty stubs for now
Change-Id: I44ed24fbd4d67a0f440202117a980c7d349016b9
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index fae40f5..278701c 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -22,12 +22,6 @@ $(eval $(call gb_Module_add_l10n_targets,sc,\
UIConfig_scalc \
))
-ifneq (,$(ENABLE_OPENCL))
-$(eval $(call gb_Module_add_targets,sc,\
- Library_scopencl \
-))
-endif
-
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Module_add_targets,sc,\
Library_scqahelper \
@@ -59,7 +53,6 @@ $(eval $(call gb_Module_add_check_targets,sc,\
$(eval $(call gb_Module_add_slowcheck_targets,sc, \
CppunitTest_sc_subsequent_filters_test \
CppunitTest_sc_subsequent_export_test \
- CppunitTest_sc_opencl_test \
))
# Disabled to allow the check tinderbox execute the sd tests
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index aba1f6d..1446294 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -71,12 +71,34 @@ public:
virtual size_t commit_segments() SAL_OVERRIDE;
};
+class ScOrcusAutoFilter : public orcus::spreadsheet::iface::import_auto_filter
+{
+public:
+ ScOrcusAutoFilter(ScDocument& rDoc);
+
+ virtual ~ScOrcusAutoFilter();
+
+ virtual void set_range(const char* p_ref, size_t n_ref);
+
+ virtual void set_column(orcus::spreadsheet::col_t col);
+
+ virtual void append_column_match_value(const char* p, size_t n);
+
+ virtual void commit_column();
+
+ virtual void commit();
+
+private:
+ ScDocument& mrDoc;
+};
+
class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
{
ScDocumentImport& mrDoc;
SCTAB mnTab;
ScOrcusFactory& mrFactory;
sc::SharedFormulaGroups maFormulaGroups;
+ ScOrcusAutoFilter maAutoFilter;
typedef std::map<size_t, ScRangeData*> SharedFormulaContainer;
SharedFormulaContainer maSharedFormulas;
@@ -88,6 +110,8 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
public:
ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& rFactory);
+ virtual orcus::spreadsheet::iface::import_auto_filter* get_auto_filter() { return &maAutoFilter; }
+
// Orcus import interface
virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n) SAL_OVERRIDE;
virtual void set_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t sindex) SAL_OVERRIDE;
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 085a2d6..8bd650e 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -192,7 +192,7 @@ void ScOrcusFactory::setStatusIndicator(const uno::Reference<task::XStatusIndica
}
ScOrcusSheet::ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& rFactory) :
- mrDoc(rDoc), mnTab(nTab), mrFactory(rFactory), mnCellCount(0) {}
+ mrDoc(rDoc), mnTab(nTab), mrFactory(rFactory), maAutoFilter(rDoc.getDoc()), mnCellCount(0) {}
void ScOrcusSheet::cellInserted()
{
@@ -647,5 +647,36 @@ size_t ScOrcusStyles::commit_cell_style()
return 0;
}
+// auto filter import
+
+ScOrcusAutoFilter::ScOrcusAutoFilter(ScDocument& rDoc):
+ mrDoc(rDoc)
+{
+ (void)mrDoc;
+}
+
+ScOrcusAutoFilter::~ScOrcusAutoFilter()
+{
+}
+
+void ScOrcusAutoFilter::set_range(const char* /*p_ref*/, size_t /*n_ref*/)
+{
+}
+
+void ScOrcusAutoFilter::set_column(orcus::spreadsheet::col_t /*col*/)
+{
+}
+
+void ScOrcusAutoFilter::append_column_match_value(const char* /*p*/, size_t /*n*/)
+{
+}
+
+void ScOrcusAutoFilter::commit_column()
+{
+}
+
+void ScOrcusAutoFilter::commit()
+{
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list