summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/docuno.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-23 21:12:15 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-29 09:59:26 +0100
commit7ecf1c5aceec1cf93e00f4caf94d06e78f678278 (patch)
tree10c15c1874fcbd2fc4c456db7aec2bd20144b7bb /sc/source/ui/unoobj/docuno.cxx
parenta8a2c49d1984447297085824b593039908498fe5 (diff)
move inline spelling setting out of document and into viewshell
like what writer does, so one view of a document can have spelling enabled and another disabled Change-Id: I9eae02fd1a2def56bfa9399860e416180fc178c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163874 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc/source/ui/unoobj/docuno.cxx')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx57
1 files changed, 40 insertions, 17 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index c46e10b23832..25a5ca8241f4 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -177,7 +177,7 @@ static std::span<const SfxItemPropertyMapEntry> lcl_GetDocOptPropertyMap()
{ SC_UNO_NULLDATE, PROP_UNO_NULLDATE, cppu::UnoType<util::Date>::get(), 0, 0},
{ SC_UNO_ROWLABELRNG, 0, cppu::UnoType<sheet::XLabelRanges>::get(), 0, 0},
{ SC_UNO_SHEETLINKS, 0, cppu::UnoType<container::XNameAccess>::get(), 0, 0},
- { SC_UNO_SPELLONLINE, PROP_UNO_SPELLONLINE, cppu::UnoType<bool>::get(), 0, 0},
+ { SC_UNO_SPELLONLINE, 0, cppu::UnoType<bool>::get(), 0, 0},
{ SC_UNO_STANDARDDEC, PROP_UNO_STANDARDDEC, cppu::UnoType<sal_Int16>::get(), 0, 0},
{ SC_UNO_REGEXENABLED, PROP_UNO_REGEXENABLED, cppu::UnoType<bool>::get(), 0, 0},
{ SC_UNO_WILDCARDSENABLED, PROP_UNO_WILDCARDSENABLED, cppu::UnoType<bool>::get(), 0, 0},
@@ -500,10 +500,27 @@ void ScModelObj::RepaintRange( const ScRangeList& rRange )
pDocShell->PostPaint(rRange, PaintPartFlags::Grid, SC_PF_TESTMERGE);
}
+static OString getTabViewRenderState(ScTabViewShell& rTabViewShell)
+{
+ OStringBuffer aState;
+
+ if (rTabViewShell.IsAutoSpell())
+ aState.append('S');
+
+ aState.append(';');
+
+ const ScViewRenderingOptions& rViewRenderingOptions = rTabViewShell.GetViewRenderingData();
+ OString aThemeName = OUStringToOString(rViewRenderingOptions.GetColorSchemeName(), RTL_TEXTENCODING_UTF8);
+ aState.append(aThemeName);
+
+ return aState.makeStringAndClear();
+}
+
static ScViewData* lcl_getViewMatchingDocZoomTab(const Fraction& rZoomX,
const Fraction& rZoomY,
const SCTAB nTab,
- const ViewShellDocId& rDocId)
+ const ViewShellDocId& rDocId,
+ std::string_view rViewRenderState)
{
constexpr size_t nMaxIter = 5;
size_t nIter = 0;
@@ -519,8 +536,11 @@ static ScViewData* lcl_getViewMatchingDocZoomTab(const Fraction& rZoomX,
continue;
ScViewData& rData = pTabViewShell->GetViewData();
- if (rData.GetTabNo() == nTab && rData.GetZoomX() == rZoomX && rData.GetZoomY() == rZoomY)
+ if (rData.GetTabNo() == nTab && rData.GetZoomX() == rZoomX && rData.GetZoomY() == rZoomY &&
+ getTabViewRenderState(*pTabViewShell) == rViewRenderState)
+ {
return &rData;
+ }
}
return nullptr;
@@ -545,7 +565,8 @@ void ScModelObj::paintTile( VirtualDevice& rDevice,
// first few shells. This is to avoid switching of zooms in ScGridWindow::PaintTile
// and hence avoid grid-offset recomputation on all shapes which is not cheap.
ScViewData* pViewData = lcl_getViewMatchingDocZoomTab(aFracX, aFracY,
- pActiveViewData->GetTabNo(), pViewShell->GetDocId());
+ pActiveViewData->GetTabNo(), pViewShell->GetDocId(),
+ getTabViewRenderState(*pViewShell));
if (!pViewData)
pViewData = pActiveViewData;
@@ -1285,8 +1306,6 @@ void ScModelObj::completeFunction(const OUString& rFunctionName)
OString ScModelObj::getViewRenderState(SfxViewShell* pViewShell)
{
- OStringBuffer aState;
-
ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
if (!pTabViewShell)
{
@@ -1295,15 +1314,9 @@ OString ScModelObj::getViewRenderState(SfxViewShell* pViewShell)
}
if (pTabViewShell)
- {
- aState.append(';');
-
- const ScViewRenderingOptions& rViewRenderingOptions = pTabViewShell->GetViewRenderingData();
- OString aThemeName = OUStringToOString(rViewRenderingOptions.GetColorSchemeName(), RTL_TEXTENCODING_UTF8);
- aState.append(aThemeName);
- }
+ return getTabViewRenderState(*pTabViewShell);
- return aState.makeStringAndClear();
+ return OString();
}
void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
@@ -1321,9 +1334,9 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans
{
if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>())
{
- ScDocOptions options = GetDocument()->GetDocOptions();
- options.SetAutoSpell(rValue.Value.get<bool>());
- GetDocument()->SetDocOptions(options);
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ if (ScTabViewShell* pTabViewShell = pViewData ? pViewData->GetViewShell() : nullptr)
+ pTabViewShell->EnableAutoSpell(rValue.Value.get<bool>());
}
else if (rValue.Name == ".uno:ChangeTheme" && rValue.Value.has<OUString>())
sThemeName = rValue.Value.get<OUString>();
@@ -2926,6 +2939,11 @@ void SAL_CALL ScModelObj::setPropertyValue(
aPropertyName == SC_UNO_LOOKUPLABELS )
bHardRecalc = false;
}
+ else if (aPropertyName == SC_UNO_SPELLONLINE)
+ {
+ if (ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(false))
+ pViewShell->EnableAutoSpell(ScUnoHelpFunctions::GetBoolFromAny(aValue));
+ }
else if ( aPropertyName == SC_UNONAME_CLOCAL )
{
lang::Locale aLocale;
@@ -3073,6 +3091,11 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
{
// done...
}
+ else if (aPropertyName == SC_UNO_SPELLONLINE)
+ {
+ if (ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(false))
+ aRet <<= pViewShell->IsAutoSpell();
+ }
else if ( aPropertyName == SC_UNONAME_CLOCAL )
{
LanguageType eLatin, eCjk, eCtl;