summaryrefslogtreecommitdiff
path: root/sw/qa/uibase/uiview/uiview.cxx
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2024-04-18 11:24:50 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-11-29 01:15:51 +0100
commit40436e1dfdad42690cc0cfc4781c38e5419e0dc5 (patch)
treea79ae0ae9926e26177588abdb6c26611c3320d50 /sw/qa/uibase/uiview/uiview.cxx
parentb440a03b30bfa5637b60dfe112d663375449d136 (diff)
tdf#146553 Enable additonal functions in editable section while in r/o mode
Insert/Edit table, insert lists, insert AutoText automatic spell checking Change-Id: Iccef3965316dc6079ea56a0283023c5a658512cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165031 Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'sw/qa/uibase/uiview/uiview.cxx')
-rw-r--r--sw/qa/uibase/uiview/uiview.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx
index 486219215581..5f41aa920c02 100644
--- a/sw/qa/uibase/uiview/uiview.cxx
+++ b/sw/qa/uibase/uiview/uiview.cxx
@@ -14,6 +14,8 @@
#include <comphelper/propertyvalue.hxx>
#include <comphelper/scopeguard.hxx>
#include <vcl/scheduler.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
#include <com/sun/star/frame/XDispatchHelper.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
@@ -22,7 +24,9 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/text/XParagraphCursor.hpp>
+#include <cmdid.h>
#include <unotxdoc.hxx>
#include <docsh.hxx>
#include <wrtsh.hxx>
@@ -320,6 +324,36 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, TestTdf152839_Formtext)
CPPUNIT_ASSERT_EQUAL(sal_Int32(723), nHeight);
}
+CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testEditInReadonly)
+{
+ createSwDoc("editinsection.odt");
+
+ SwDocShell* pDocShell = getSwDocShell();
+ SwView* pView = pDocShell->GetView();
+
+ pView->GetViewFrame().GetDispatcher()->Execute(SID_EDITDOC, SfxCallMode::SYNCHRON);
+
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XParagraphCursor> xParaCursor(xTextDocument->getText()->createTextCursor(),
+ uno::UNO_QUERY);
+
+ uno::Reference<view::XSelectionSupplier> xSelSupplier(xModel->getCurrentController(),
+ uno::UNO_QUERY_THROW);
+
+ xSelSupplier->select(css::uno::Any(xParaCursor));
+ std::unique_ptr<SfxPoolItem> pItem;
+ SfxItemState eState = pView->GetViewFrame().GetBindings().QueryState(FN_INSERT_TABLE, pItem);
+ //status disabled in read only content
+ CPPUNIT_ASSERT_EQUAL(SfxItemState::DISABLED, eState);
+
+ //move cursor to section
+ xParaCursor->gotoNextParagraph(false);
+ xSelSupplier->select(css::uno::Any(xParaCursor));
+ eState = pView->GetViewFrame().GetBindings().QueryState(FN_INSERT_TABLE, pItem);
+ //status default in editable section
+ CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, eState);
+}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */