[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - 5 commits - chart2/source sc/inc sc/source xmloff/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Thu May 1 12:56:55 PDT 2014
chart2/source/controller/chartapiwrapper/TitleWrapper.cxx | 2
chart2/source/tools/ErrorBar.cxx | 2
sc/inc/globstr.hrc | 5 +
sc/source/core/data/colorscale.cxx | 2
sc/source/filter/excel/xecontent.cxx | 4 -
sc/source/ui/docshell/docfunc.cxx | 40 ++++++++++
sc/source/ui/inc/undoblk.hxx | 22 +++++
sc/source/ui/src/globstr.src | 4 +
sc/source/ui/undo/undoblk.cxx | 52 ++++++++++++++
xmloff/source/chart/SchXMLPlotAreaContext.cxx | 15 ++++
10 files changed, 140 insertions(+), 8 deletions(-)
New commits:
commit 6a8d8c4bbd248816ce8d542c293e3db2f8df384c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Apr 29 00:48:07 2014 +0200
the safety check was a bit too strict, fdo#77984
Change-Id: Idfc3b3dd1d9f4de428e43c515b13a8d7e40e347c
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 2eca97c..e1e203a 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -796,7 +796,7 @@ ScIconSetInfo* ScIconSetFormat::GetIconSetInfo(const ScAddress& rAddr) const
double nMax = GetMaxValue();
// this check is for safety
- if(nMin >= nMax)
+ if(nMin > nMax)
return NULL;
sal_Int32 nIndex = 0;
commit 85c73e11d81c067d7f604570dc6796108541d7ce
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Apr 29 20:37:36 2014 +0200
escape conditional formatting formulas during xlsx export, fdo#75168
Conflicts:
sc/source/filter/excel/xecontent.cxx
Change-Id: I9ebdb2315b51c2b53d8cfa0486b3ec22a8e0d88d
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 706f24c..7fe8b9a 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -941,13 +941,13 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
if(!IsTextRule(eOperation) && !IsTopBottomRule(eOperation))
{
rWorksheet->startElement( XML_formula, FSEND );
- rWorksheet->write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(),
+ rWorksheet->writeEscaped(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(),
mrFormatEntry.CreateTokenArry( 0 ), GetRoot().GetOpCodeMap() ));
rWorksheet->endElement( XML_formula );
if (bFmla2)
{
rWorksheet->startElement( XML_formula, FSEND );
- rWorksheet->write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(),
+ rWorksheet->writeEscaped(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(),
mrFormatEntry.CreateTokenArry( 1 ), GetRoot().GetOpCodeMap() ));
rWorksheet->endElement( XML_formula );
}
commit 66c2360491614597ba1e8b05dff33e6b142e382d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Apr 30 01:20:36 2014 +0200
set graphic properties for error bars during import, fdo#78041
Change-Id: I43138745b074dcacdafa090d97eeb9aa2ccecf78
diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx
index 805b4e6..00fe6ed 100644
--- a/chart2/source/tools/ErrorBar.cxx
+++ b/chart2/source/tools/ErrorBar.cxx
@@ -165,7 +165,7 @@ void ErrorBar::setPropertyValue( const OUString& rPropName, const uno::Any& rAny
else if(rPropName == "ShowNegativeError")
rAny >>= mbShowNegativeError;
else if(rPropName == "ErrorBarRangePositive" || rPropName == "ErrorBarRangeNegative")
- throw uno::RuntimeException("read-only property", static_cast< uno::XWeak*>(this));
+ throw beans::UnknownPropertyException("read-only property", static_cast< uno::XWeak*>(this));
else
LineProperties::setPropertyValue(rPropName, rAny);
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index d8b56b2..b34e2af 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -1025,6 +1025,19 @@ SchXMLStatisticsObjectContext::~SchXMLStatisticsObjectContext()
namespace {
+void SetErrorBarStyleProperties( const OUString& rStyleName, uno::Reference< beans::XPropertySet > xBarProp,
+ SchXMLImportHelper& rImportHelper )
+{
+ const SvXMLStylesContext* pStylesCtxt = rImportHelper.GetAutoStylesContext();
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(rImportHelper.GetChartFamilyID(),
+ rStyleName);
+
+ XMLPropStyleContext * pSeriesStyleContext =
+ const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
+
+ pSeriesStyleContext->FillPropertySet( xBarProp );
+}
+
void SetErrorBarPropertiesFromStyleName( const OUString& aStyleName, uno::Reference< beans::XPropertySet> xBarProp,
SchXMLImportHelper& rImportHelper, OUString& aPosRange, OUString& aNegRange)
{
@@ -1198,6 +1211,8 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
// first import defaults from parent style
+ SetErrorBarStyleProperties( maSeriesStyleName, xBarProp, mrImportHelper );
+ SetErrorBarStyleProperties( sAutoStyleName, xBarProp, mrImportHelper );
SetErrorBarPropertiesFromStyleName( maSeriesStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
SetErrorBarPropertiesFromStyleName( sAutoStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
commit a9a1f801ba44ae2779863a0f6fab11e27aa45ead
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Apr 30 02:33:02 2014 +0200
be explicit about text rotations, fdo#70670
Change-Id: I5090a49c2383e6a30165a8eca22b527972c0f507
diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
index ad07eb1..43b6d6f 100644
--- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
@@ -516,7 +516,7 @@ const std::vector< WrappedProperty* > TitleWrapper::createWrappedProperties()
::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
aWrappedProperties.push_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) );
- aWrappedProperties.push_back( new WrappedTextRotationProperty( m_eTitleType==TitleHelper::Y_AXIS_TITLE || m_eTitleType==TitleHelper::X_AXIS_TITLE ) );
+ aWrappedProperties.push_back( new WrappedTextRotationProperty( true ) );
aWrappedProperties.push_back( new WrappedStackedTextProperty() );
WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
commit 318b374e44b76d8b2b33219f07f8af5c9556ed53
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
Conflicts:
sc/inc/globstr.hrc
sc/source/ui/src/globstr.src
Conflicts:
sc/inc/globstr.hrc
Change-Id: I11db1e5824077135c4352ae43cc0e8d139244268
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 53e6e30..d54d855 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -493,6 +493,7 @@
#define STR_SCATTR_PAGE_SCALE_PAGES 389
#define STR_SCATTR_PAGE_SCALE_AUTO 390
+<<<<<<< HEAD
#define STR_UNDO_TAB_RTL 391
#define STR_UNDO_HANGULHANJA 392
#define STR_UNDO_CHINESE_TRANSLATION 393
@@ -676,7 +677,9 @@
#define STR_PRINT_PREVIEW_NODATA 547
#define STR_PRINT_PREVIEW_EMPTY_RANGE 548
-#define STR_COUNT 549
+#define STR_UNDO_CONDFORMAT 549
+
+#define STR_COUNT 550
#endif
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index b922508..1ef8e93 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5354,6 +5354,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)
{
@@ -5370,9 +5395,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);
@@ -5380,6 +5405,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 470e7d3..b146cef 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -634,6 +634,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 a408cb0..7e329cf 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -2075,6 +2075,10 @@ 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 a6049f1..c2e011c 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -59,6 +59,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);
@@ -1404,6 +1405,57 @@ sal_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,
More information about the Libreoffice-commits
mailing list