sc: change how .uno:FreezePanesColumn/Row get the index
On commit "sc: fix freeze row/column panes"
44362e5886
the type of FreezePanesColumn and FreezePanesRow was changed from Int32 to Point. Since then, calls
trying to set the frozen panes with this commands sending an index fail,
setting the index to 1.
This change allows again a way to set them passing only an index of type
Int32.
Change-Id: I9de12af5ec7dbb4e49b057c7c19c063424265581
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174825
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 3eec1925788387c7c5996052388f3fcac518dfe7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174956
Tested-by: Jenkins
This commit is contained in:
parent
235c230cd3
commit
02d1b4923a
3 changed files with 65 additions and 13 deletions
|
@ -617,20 +617,32 @@ public:
|
|||
case LOK_CALLBACK_STATE_CHANGED:
|
||||
{
|
||||
std::stringstream aStream(pPayload);
|
||||
if (!aStream.str().starts_with("{"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
boost::property_tree::ptree aTree;
|
||||
boost::property_tree::read_json(aStream, aTree);
|
||||
auto it = aTree.find("commandName");
|
||||
if (it == aTree.not_found())
|
||||
std::string aCommandName;
|
||||
|
||||
if (aStream.str().starts_with("{"))
|
||||
{
|
||||
break;
|
||||
boost::property_tree::read_json(aStream, aTree);
|
||||
auto it = aTree.find("commandName");
|
||||
if (it == aTree.not_found())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
aCommandName = it->second.get_value<std::string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string aState = aStream.str();
|
||||
auto it = aState.find("=");
|
||||
if (it == std::string::npos)
|
||||
{
|
||||
break;
|
||||
}
|
||||
aCommandName = aState.substr(0, it);
|
||||
aTree.put("state", aState.substr(it + 1));
|
||||
}
|
||||
|
||||
std::string aCommandName = it->second.get_value<std::string>();
|
||||
m_aStateChanges[aCommandName] = aTree;
|
||||
}
|
||||
break;
|
||||
|
@ -3992,6 +4004,46 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testLeftOverflowEdit)
|
|||
CPPUNIT_ASSERT_EQUAL(tools::Long(20), aView.m_aTextSelectionResult.m_aRefPoint.getX());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testFreezeRowOrColumn)
|
||||
{
|
||||
createDoc("empty.ods");
|
||||
ViewCallback aView;
|
||||
SfxViewShell* pView = SfxViewShell::Current();
|
||||
|
||||
// Freeze panes on a column and receive the proper state back
|
||||
aView.m_aStateChanges.clear();
|
||||
uno::Sequence<beans::PropertyValue> aPropertyValues = {
|
||||
comphelper::makePropertyValue("Index", uno::Any(static_cast<sal_Int32>(8))),
|
||||
};
|
||||
comphelper::dispatchCommand(".uno:FreezePanesColumn", aPropertyValues);
|
||||
Scheduler::ProcessEventsToIdle();
|
||||
pView->GetViewFrame().GetBindings().GetTimer().Invoke();
|
||||
pView->GetViewFrame().GetBindings().GetTimer().Invoke();
|
||||
auto it = aView.m_aStateChanges.find(".uno:FreezePanesColumn");
|
||||
CPPUNIT_ASSERT(it != aView.m_aStateChanges.end());
|
||||
std::string values = it->second.get<std::string>("state");
|
||||
std::string index = values.substr(0, values.find(' '));
|
||||
// Without the accompanying fix in place, this test would have failed with:
|
||||
// - Expected: 8
|
||||
// - Actual : 1
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("8"), index);
|
||||
|
||||
// Freeze panes on a row and receive the proper state back
|
||||
aView.m_aStateChanges.clear();
|
||||
comphelper::dispatchCommand(".uno:FreezePanesRow", aPropertyValues);
|
||||
Scheduler::ProcessEventsToIdle();
|
||||
pView->GetViewFrame().GetBindings().GetTimer().Invoke();
|
||||
pView->GetViewFrame().GetBindings().GetTimer().Invoke();
|
||||
it = aView.m_aStateChanges.find(".uno:FreezePanesRow");
|
||||
CPPUNIT_ASSERT(it != aView.m_aStateChanges.end());
|
||||
values = it->second.get<std::string>("state");
|
||||
index = values.substr(0, values.find(' '));
|
||||
// Without the accompanying fix in place, this test would have failed with:
|
||||
// - Expected: 8
|
||||
// - Actual : 1
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("8"), index);
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -1979,7 +1979,7 @@ SfxVoidItem FreezePanes SID_WINDOW_FIX
|
|||
]
|
||||
|
||||
SfxPointItem FreezePanesColumn SID_WINDOW_FIX_COL
|
||||
|
||||
(SfxInt32Item Index FN_PARAM_1)
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
|
@ -1996,7 +1996,7 @@ SfxPointItem FreezePanesColumn SID_WINDOW_FIX_COL
|
|||
]
|
||||
|
||||
SfxPointItem FreezePanesRow SID_WINDOW_FIX_ROW
|
||||
|
||||
(SfxInt32Item Index FN_PARAM_1)
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
|
|
|
@ -1334,7 +1334,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
|
|||
{
|
||||
bool bIsCol = (nSlot == SID_WINDOW_FIX_COL);
|
||||
sal_Int32 nFreezeIndex = 1;
|
||||
if (const SfxInt32Item* pItem = rReq.GetArg<SfxInt32Item>(nSlot))
|
||||
if (const SfxInt32Item* pItem = rReq.GetArg<SfxInt32Item>(FN_PARAM_1))
|
||||
{
|
||||
nFreezeIndex = pItem->GetValue();
|
||||
if (nFreezeIndex < 0)
|
||||
|
|
Loading…
Reference in a new issue