summaryrefslogtreecommitdiff
path: root/sc/source/core/data
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data')
-rw-r--r--sc/source/core/data/colorscale.cxx21
-rw-r--r--sc/source/core/data/conditio.cxx20
-rw-r--r--sc/source/core/data/dpoutput.cxx6
-rw-r--r--sc/source/core/data/global.cxx6
-rw-r--r--sc/source/core/data/stlpool.cxx20
-rw-r--r--sc/source/core/data/table2.cxx3
6 files changed, 72 insertions, 4 deletions
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 52496653ab1b..8b1a8987acbb 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -379,6 +379,9 @@ ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc, const ScColorScaleForma
{
maColorScales.emplace_back(new ScColorScaleEntry(pDoc, *rxEntry));
}
+
+ auto aCache = rFormat.GetCache();
+ SetCache(aCache);
}
ScColorFormat* ScColorScaleFormat::Clone(ScDocument* pDoc) const
@@ -440,6 +443,18 @@ const ScRangeList& ScColorFormat::GetRange() const
return mpParent->GetRange();
}
+std::vector<double> ScColorFormat::GetCache() const
+{
+ std::vector<double> empty;
+ return mpCache ? mpCache->maValues : empty;
+}
+
+void ScColorFormat::SetCache(const std::vector<double>& aValues)
+{
+ mpCache.reset(new ScColorFormatCache);
+ mpCache->maValues = aValues;
+}
+
std::vector<double>& ScColorFormat::getValues() const
{
if(!mpCache)
@@ -512,6 +527,12 @@ void ScColorFormat::endRendering()
mpCache.reset();
}
+void ScColorFormat::updateValues()
+{
+ getMinValue();
+ getMaxValue();
+}
+
namespace {
sal_uInt8 GetColorValue( double nVal, double nVal1, sal_uInt8 nColVal1, double nVal2, sal_uInt8 nColVal2 )
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 35a6ff99c699..72446f306562 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -73,6 +73,10 @@ void ScFormatEntry::endRendering()
{
}
+void ScFormatEntry::updateValues()
+{
+}
+
static bool lcl_HasRelRef( ScDocument* pDoc, const ScTokenArray* pFormula, sal_uInt16 nRecursion = 0 )
{
if (pFormula)
@@ -2040,6 +2044,14 @@ void ScConditionalFormat::endRendering()
}
}
+void ScConditionalFormat::updateValues()
+{
+ for(auto& rxEntry : maEntries)
+ {
+ rxEntry->updateValues();
+ }
+}
+
void ScConditionalFormat::CalcAll()
{
for(const auto& rxEntry : maEntries)
@@ -2287,6 +2299,14 @@ void ScConditionalFormatList::endRendering()
}
}
+void ScConditionalFormatList::updateValues()
+{
+ for (auto const& it : m_ConditionalFormats)
+ {
+ it->updateValues();
+ }
+}
+
void ScConditionalFormatList::clear()
{
m_ConditionalFormats.clear();
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index fe54b7c1086c..7c0e6f01ebaf 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -599,7 +599,11 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
case sheet::DataPilotFieldOrientation_ROW:
{
uno::Sequence<sheet::MemberResult> aResult = xLevRes->getResults();
- if (!lcl_MemberEmpty(aResult))
+ // We want only to remove the DATA column if it is empty
+ // and not any other empty columns (to still show the
+ // header columns)
+ bool bSkip = lcl_MemberEmpty(aResult) && bIsDataLayout;
+ if (!bSkip)
{
ScDPOutLevelData tmp(nDim, nHierarchy, nLev, nDimPos, nNumFmt, aResult, aName,
aCaption, bHasHiddenMember, bIsDataLayout, false);
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 8295b8033182..b40f0ceaa5f9 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -36,6 +36,7 @@
#include <svl/zformat.hxx>
#include <vcl/keycodes.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/weld.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <unotools/charclass.hxx>
@@ -772,7 +773,7 @@ void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, bool bIgno
OUString aUrlName( rURL );
SfxViewFrame* pFrame = nullptr;
- const SfxObjectShell* pObjShell = nullptr;
+ SfxObjectShell* pObjShell = nullptr;
OUString aReferName;
if ( pScActiveViewShell )
{
@@ -806,6 +807,9 @@ void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, bool bIgno
aUrlName = aNewUrlName;
}
+ if (!SfxObjectShell::AllowedLinkProtocolFromDocument(aUrlName, pObjShell, pFrame ? pFrame->GetFrameWeld() : nullptr))
+ return;
+
SfxStringItem aUrl( SID_FILE_NAME, aUrlName );
SfxStringItem aTarget( SID_TARGETNAME, rTarget );
if ( nScClickMouseModifier & KEY_SHIFT ) // control-click -> into new window
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 3939978633f3..ce8617a66150 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -411,14 +411,30 @@ ScStyleSheet* ScStyleSheetPool::FindCaseIns( const OUString& rName, SfxStyleFami
CaseInsensitiveNamePredicate aPredicate(rName, eFam);
std::vector<sal_Int32> aFoundPositions = GetIndexedStyleSheets().FindPositionsByPredicate(aPredicate);
+ ScStyleSheet* first = nullptr; // first case insensitive match found
for (const auto& rPos : aFoundPositions)
{
SfxStyleSheetBase *pFound = GetStyleSheetByPositionInIndex(rPos);
// we do not know what kind of sheets we have.
if (pFound->isScStyleSheet())
- return static_cast<ScStyleSheet*>(pFound);
+ {
+ if (pFound->GetName() == rName) // exact case sensitive match
+ return static_cast<ScStyleSheet*>(pFound);
+ if (!first)
+ first = static_cast<ScStyleSheet*>(pFound);
+ }
}
- return nullptr;
+ return first;
+}
+
+ScStyleSheet* ScStyleSheetPool::FindAutoStyle(const OUString& rName)
+{
+ ScStyleSheet* pStyleSheet = FindCaseIns(rName, SfxStyleFamily::Para);
+ if (!pStyleSheet)
+ if (auto pFound = Find(ScResId(STR_STYLENAME_STANDARD), SfxStyleFamily::Para))
+ if (pFound->isScStyleSheet()) // we do not know what kind of sheets we have
+ pStyleSheet = static_cast<ScStyleSheet*>(pFound);
+ return pStyleSheet;
}
void ScStyleSheetPool::setAllParaStandard()
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index c2de8dead98c..1f5d1fb34f4b 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -522,7 +522,10 @@ void ScTable::CopyToClip(
for (SCCOL i = nCol1; i <= nCol2; i++)
pTable->aCol[i].RemoveProtected(nRow1, nRow2);
+ mpCondFormatList->startRendering();
+ mpCondFormatList->updateValues();
pTable->mpCondFormatList.reset(new ScConditionalFormatList(pTable->rDocument, *mpCondFormatList));
+ mpCondFormatList->endRendering();
}
void ScTable::CopyToClip(