[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2023-11-17 Thread Miklos Vajna (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |8 +
 sw/inc/cmdid.h  |1 
 sw/inc/fesh.hxx |2 
 sw/qa/core/frmedt/frmedt.cxx|   41 
++
 sw/sdi/_frmsh.sdi   |7 +
 sw/sdi/swriter.sdi  |   17 
 sw/source/core/frmedt/fefly1.cxx|   40 
+
 sw/source/uibase/docvw/UnfloatTableButton.cxx   |   16 ---
 sw/source/uibase/shells/frmsh.cxx   |6 +
 sw/uiconfig/swriter/popupmenu/frame.xml |1 
 10 files changed, 125 insertions(+), 14 deletions(-)

New commits:
commit 871ca5dd73b34086fad1e57d4697f43a6739a11d
Author: Miklos Vajna 
AuthorDate: Fri Nov 17 08:31:41 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 17 10:13:58 2023 +0100

sw floattable, delete UI: add an uno command to unfloat frame from context 
menu

Word has an easy UI to turn floating tables into inline ones. Writer had
a similar button, but that had a few shortcomings:

1) It was only visible if a non-split frame was too large to fit the
   page.

2) It was a separate VCL widget, so invisible to LOK clients.

3) It only worked for frames which had a single table in them.

Researching the problem, it's interesting how deleting a frame always
deletes its content as well, but e.g. deleting a section just removes
the container but leaves the content in the body text.

Fix the problem by adding a new menu item in the context menu that
always allows converting the frame to inline content at the anchor
point. This can share a bit of code with the old unfloat button.

The undo/redo still needs fixing, in a follow-up change.

Change-Id: I8ce05c9f958b08cb599fd5d2a27e770182f28cc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159550
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index dc4d4dbdb399..247f94688255 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -827,6 +827,14 @@
   1
 
   
+  
+
+  Unfloat Frame Content
+
+
+  1
+
+  
   
 
   Insert Index Entry
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 74ab5cf8c554..165b6aa60a30 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -242,6 +242,7 @@ class SwUINumRuleItem;
 
 #define FN_INSERT_IDX_ENTRY_DLG (FN_INSERT + 35)/* insert index entry */
 #define FN_INSERT_FRAME_INTERACT_NOCOL (FN_INSERT + 36) /*insert interactive 
non column frame*/
+#define FN_UNFLOAT_FRAME TypedWhichId(FN_INSERT + 37) /* 
Unfloat Frame */
 
 #define FN_TOOL_ANCHOR_PAGE (FN_INSERT + 50)/* anchor Draw object to 
page */
 #define FN_TOOL_ANCHOR_PARAGRAPH (FN_INSERT + 51)   /* anchor Draw object to 
paragraph */
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index ce1cdc79f3fd..a0a3a64176d7 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -268,6 +268,8 @@ public:
 
 void SelectFlyFrame( SwFlyFrame& rFrame );
 
+void UnfloatFlyFrame();
+
 /// Is selected frame within another frame?
 const SwFrameFormat* IsFlyInFly();
 
diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx
index f5a12e9392f1..55c6c7b9d01f 100644
--- a/sw/qa/core/frmedt/frmedt.cxx
+++ b/sw/qa/core/frmedt/frmedt.cxx
@@ -26,6 +26,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /// Covers sw/source/core/frmedt/ fixes.
 class SwCoreFrmedtTest : public SwModelTestBase
@@ -196,6 +198,45 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, 
testSplitFlyInsertCaption)
 CPPUNIT_ASSERT(!pFly->GetAttrSet().GetFlySplit().GetValue());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testSplitFlyUnfloat)
+{
+// Given a document with a floating table:
+createSwDoc();
+SwDoc* pDoc = getSwDocShell()->GetDoc();
+sw::FrameFormats& rFlyFormats = 
*pDoc->GetSpzFrameFormats();
+CPPUNIT_ASSERT(rFlyFormats.empty());
+// Insert a table:
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/1);
+pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
+pWrtShell->GoPrevCell();
+pWrtShell->Insert("A1");
+pWrtShell->GoNextCell();
+pWrtShell->Insert("A2");
+// Select cell:
+pWrtShell->SelAll();
+// Select table:
+pWrtShell->SelAll();
+// Wrap the table in a 

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2023-10-25 Thread Xisco Fauli (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |   20 
+
 sw/inc/cmdid.h  |   20 
+++--
 sw/qa/uibase/shells/shells.cxx  |8 --
 sw/sdi/_textsh.sdi  |   14 
 sw/sdi/swriter.sdi  |   34 
++
 sw/source/uibase/shells/textfld.cxx |4 +
 sw/uiconfig/sglobal/popupmenu/insertfield.xml   |2 
 sw/uiconfig/sweb/popupmenu/insertfield.xml  |2 
 sw/uiconfig/swform/popupmenu/insertfield.xml|2 
 sw/uiconfig/swreport/popupmenu/insertfield.xml  |2 
 sw/uiconfig/swriter/popupmenu/insertfield.xml   |2 
 sw/uiconfig/swxform/popupmenu/insertfield.xml   |2 
 12 files changed, 96 insertions(+), 16 deletions(-)

New commits:
commit 6c073a180b6af61963fcce0da63ba66b97357ccb
Author: Xisco Fauli 
AuthorDate: Tue Oct 24 15:25:13 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Oct 25 12:25:53 2023 +0200

tdf#139141: Add UNO commands for variable date/time fields

Impress already has both options in the menu
Also re-enable test disable with fa569930a0968cdeba4441e19a68e7d78aa25cb4
"Revert "Resolves tdf#139141 - Make variable date/time field the
default""

Change-Id: I1cec89b5901073555ffa31d2be24e1e62fbbdcb3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158391
Reviewed-by: Heiko Tietze 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 44a98e183ccc..dc4d4dbdb399 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -1076,7 +1076,15 @@
   
   
 
-  ~Date
+  ~Date (fix)
+
+
+  1
+
+  
+  
+
+  ~Date (variable)
 
 
   1
@@ -1092,7 +1100,15 @@
   
   
 
-  ~Time
+  ~Time (fix)
+
+
+  1
+
+  
+  
+
+  ~Time (variable)
 
 
   1
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 08f239b3d8d0..74ab5cf8c554 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -267,18 +267,20 @@ class SwUINumRuleItem;
 #define FN_MAILMERGE_PRINT_DOCUMENTS (FN_INSERT + 79) /* mail merge toolbar - 
print merged documents */
 #define FN_MAILMERGE_EMAIL_DOCUMENTS (FN_INSERT + 80) /* mail merge toolbar - 
email merged documents */
 
-#define FN_TOOL_ANCHOR_CHAR (FN_INSERT + 84)/* anchor Draw object to 
character */
+#define FN_TOOL_ANCHOR_CHAR (FN_INSERT + 82)/* anchor Draw object to 
character */
 
-#define FN_QRY_INSERT   (FN_INSERT + 86)/* insert record selection 
in to text */
-#define FN_QRY_MERGE_FIELD  (FN_INSERT + 87)/* insert record selection 
into fields */
-#define FN_QRY_INSERT_FIELD (FN_INSERT + 88)/* insert database field */
+#define FN_QRY_INSERT   (FN_INSERT + 83)/* insert record selection 
in to text */
+#define FN_QRY_MERGE_FIELD  (FN_INSERT + 84)/* insert record selection 
into fields */
+#define FN_QRY_INSERT_FIELD (FN_INSERT + 86)/* insert database field */
 
-#define FN_INSERT_CTRL  (FN_INSERT + 89)/* toolbar controller 
insert*/
-#define FN_INSERT_OBJ_CTRL  (FN_INSERT + 90)/* toolbar controller 
(insert/object) */
-#define FN_INSERT_FIELD_CTRL(FN_INSERT + 91)/* toolbar controller 
insert/field commands */
+#define FN_INSERT_CTRL  (FN_INSERT + 87)/* toolbar controller 
insert*/
+#define FN_INSERT_OBJ_CTRL  (FN_INSERT + 88)/* toolbar controller 
(insert/object) */
+#define FN_INSERT_FIELD_CTRL(FN_INSERT + 89)/* toolbar controller 
insert/field commands */
 
-#define FN_INSERT_FLD_DATE  (FN_INSERT + 92)
-#define FN_INSERT_FLD_TIME  (FN_INSERT + 93)
+#define FN_INSERT_FLD_DATE  (FN_INSERT + 90)
+#define FN_INSERT_FLD_DATE_VAR  (FN_INSERT + 91)
+#define FN_INSERT_FLD_TIME  (FN_INSERT + 92)
+#define FN_INSERT_FLD_TIME_VAR  (FN_INSERT + 93)
 #define FN_INSERT_FLD_PGNUMBER  (FN_INSERT + 94)
 #define FN_INSERT_FLD_PGCOUNT   (FN_INSERT + 95)
 #define FN_INSERT_FLD_TOPIC (FN_INSERT + 96)
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index 88f90e909698..8551ef685e1f 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -1049,9 +1049,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, 
testInsertTextFormFieldEndnote)
 // Then this was empty: the fieldmark was inserted before the note anchor, 
not in the note body.
 

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2023-05-15 Thread TokieSan (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |8 ++
 sw/inc/cmdid.h  |1 
 sw/qa/uibase/shells/shells.cxx  |   29 
++
 sw/sdi/_textsh.sdi  |6 ++
 sw/sdi/swriter.sdi  |   18 
++
 sw/source/uibase/shells/textfld.cxx |   20 
++
 sw/uiconfig/swriter/menubar/menubar.xml |1 
 sw/uiconfig/swriter/popupmenu/table.xml |1 
 sw/uiconfig/swriter/popupmenu/text.xml  |1 
 9 files changed, 85 insertions(+)

New commits:
commit 627a601d1fcea0b3198654756d351b0b81600b49
Author: TokieSan 
AuthorDate: Sat Apr 15 19:05:12 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 15 08:56:46 2023 +0200

tdf#148979 Added option to update selected field

Added Uno command UpdateSelectedField, FN_UPDATE_SEL_FIELD
to support updating a single selected field

Change-Id: Ia1a2387e137f8a672a24056b13234d4275a77ca4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150450
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 8e9715c24acd..617901255c4b 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -1636,6 +1636,14 @@
   1
 
   
+  
+
+  Update Selected Field
+
+
+  1
+
+  
   
 
   E~xternal Links...
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 5459c63b8ff1..d330f36966bd 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -78,6 +78,7 @@ class SwUINumRuleItem;
 #define FN_EDIT_LINK_DLG(FN_EDIT + 9 )/* Edit link dialog */
 
 #define FN_NUMBER_BULLETS   (FN_EDIT + 21)/* Bullets */
+#define FN_UPDATE_SEL_FIELD (FN_EDIT + 22 )   /* Update selected field */
 #define FN_EDIT_IDX_ENTRY_DLG   (FN_EDIT + 23)/* Edit Index-Entry */
 #define FN_UPDATE_FIELDS(FN_EDIT + 26)/* Update fields */
 #define FN_EXECUTE_MACROFIELD   (FN_EDIT + 27)/* Execute macrofield */
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index 8c251cb09f87..c962f4a5d65e 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1049,6 +1050,34 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, 
testInsertTextFormFieldEndnote)
 CPPUNIT_ASSERT_EQUAL(OUString("result"), aActual);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSelectedField)
+{
+// Given an empty doc:
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
+
+// Insert a time field and select it:
+dispatchCommand(mxComponent, ".uno:InsertTimeField", {});
+
+pCursor->SetMark();
+pCursor->Move(fnMoveBackward);
+
+OUString aTimeFieldBefore, aTimeFieldAfter;
+pWrtShell->GetSelectedText(aTimeFieldBefore);
+
+// Wait for one second:
+osl::Thread::wait(std::chrono::seconds(1));
+
+// Update the field at cursor:
+dispatchCommand(mxComponent, ".uno:UpdateSelectedField", {});
+pWrtShell->GetSelectedText(aTimeFieldAfter);
+
+// Check that the selected field has changed:
+CPPUNIT_ASSERT(aTimeFieldAfter != aTimeFieldBefore);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 45f6eb7c9bdb..086a7622b137 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1010,6 +1010,12 @@ interface BaseText
 StateMethod = StateField ;
 DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
 ]
+FN_UPDATE_SEL_FIELD
+[
+ExecMethod = ExecField ;
+StateMethod = StateField ;
+DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+]
 FN_GLOSSARY_DLG // status()
 [
 ExecMethod = ExecGlossary ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 15d098cc996c..b765d861e34a 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -1246,6 +1246,24 @@ SfxVoidItem FieldDialog FN_EDIT_FIELD
 GroupId = SfxGroupId::Edit;
 ]
 
+SfxVoidItem UpdateSelectedField FN_UPDATE_SEL_FIELD
+()
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = FALSE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+Asynchron;
+
+AccelConfig = TRUE,
+MenuConfig = TRUE,
+ToolBoxConfig = TRUE,
+GroupId = 

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2022-09-23 Thread Miklos Vajna (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |8 +++
 sw/inc/cmdid.h  |1 
 sw/qa/uibase/wrtsh/wrtsh.cxx|   22 
++
 sw/sdi/_textsh.sdi  |6 ++
 sw/sdi/swriter.sdi  |   17 
+++
 sw/source/uibase/shells/textsh.cxx  |5 ++
 sw/source/uibase/uiview/view.cxx|1 
 sw/uiconfig/swriter/menubar/menubar.xml |1 
 sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml   |1 
 9 files changed, 62 insertions(+)

New commits:
commit 49f1bf56ebfa3c96aa90835c1121eb827d713b9d
Author: Miklos Vajna 
AuthorDate: Fri Sep 23 08:55:08 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Sep 23 10:35:22 2022 +0200

sw content controls, combo box: add insert UI

- expose the combo box case in SwWrtShell::InsertContentControl() as a
  new .uno:InsertComboBoxContentControl command

- - add the new uno command to the default & MS-compatible menus

Change-Id: Ifb1a9cede8c219d956ce438119ee789a69507679
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140468
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index fa208dcd645d..bd7dff5b6cf6 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -675,6 +675,14 @@
   1
 
   
+  
+
+  Insert Combo Box Content Control
+
+
+  1
+
+  
   
 
   Insert Other Objects
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index f183108c071e..d98d72ce56b5 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -229,6 +229,7 @@ class SwUINumRuleItem;
 #define FN_POSTIT   (FN_INSERT + 29)/* Insert/edit PostIt */
 #define FN_INSERT_TABLE (FN_INSERT + 30)/* Insert Table */
 #define FN_INSERT_STRING(FN_INSERT+31)
+#define FN_INSERT_COMBO_BOX_CONTENT_CONTROL (FN_INSERT + 32) /* Combo box 
content control */
 #define FN_INSERT_FRAME_INTERACT (FN_INSERT + 33)   /* Insert interactive 
frame */
 #define FN_INSERT_FRAME (FN_INSERT + 34)/* Insert Frame */
 
diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx
index fb0d9d80d64a..e40f641e706a 100644
--- a/sw/qa/uibase/wrtsh/wrtsh.cxx
+++ b/sw/qa/uibase/wrtsh/wrtsh.cxx
@@ -388,6 +388,28 @@ CPPUNIT_TEST_FIXTURE(Test, 
testInsertPlainTextContentControl)
 // handling for plain text content controls.
 CPPUNIT_ASSERT(pContentControl->GetPlainText());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInsertComboBoxContentControl)
+{
+// Given an empty document:
+SwDoc* pDoc = createSwDoc();
+
+// When inserting a combo box content control:
+dispatchCommand(mxComponent, ".uno:InsertComboBoxContentControl", {});
+
+// Then make sure that the matching text attribute is added to the 
document model:
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwTextNode* pTextNode = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
+// Without the accompanying fix in place, this test would have failed, no 
content control was
+// inserted.
+SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
+CPPUNIT_ASSERT(pAttr);
+auto pTextContentControl = 
static_txtattr_cast(pAttr);
+auto& rFormatContentControl
+= static_cast(pTextContentControl->GetAttr());
+std::shared_ptr pContentControl = 
rFormatContentControl.GetContentControl();
+CPPUNIT_ASSERT(pContentControl->GetComboBox());
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index f9788707eb84..3ef8211e33c7 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -314,6 +314,12 @@ interface BaseText
 StateMethod = NoState ;
 DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
 ]
+FN_INSERT_COMBO_BOX_CONTENT_CONTROL  // status(final|play)
+[
+ExecMethod = ExecInsert ;
+StateMethod = NoState ;
+DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+]
 FN_CONTENT_CONTROL_PROPERTIES  // status(final|play)
 [
 ExecMethod = ExecInsert ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 78f1d7cd74b0..044feca164f3 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -3152,6 +3152,23 @@ SfxVoidItem InsertPlainTextContentControl 
FN_INSERT_PLAIN_TEXT_CONTENT_CONTROL
 GroupId = SfxGroupId::Insert;
 ]
 
+SfxVoidItem InsertComboBoxContentControl FN_INSERT_COMBO_BOX_CONTENT_CONTROL
+()
+[
+AutoUpdate = FALSE,
+   

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2022-07-26 Thread Miklos Vajna (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |8 +++
 sw/inc/cmdid.h  |1 
 sw/qa/uibase/wrtsh/wrtsh.cxx|   21 
++
 sw/sdi/_textsh.sdi  |6 ++
 sw/sdi/swriter.sdi  |   17 

 sw/source/uibase/shells/textsh.cxx  |5 ++
 sw/source/uibase/uiview/view.cxx|2 
 sw/source/uibase/wrtsh/wrtsh1.cxx   |4 +
 sw/uiconfig/swriter/menubar/menubar.xml |1 
 sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml   |1 
 10 files changed, 65 insertions(+), 1 deletion(-)

New commits:
commit 7748a0c437855133fb0a0ebadb60f5f083112f20
Author: Miklos Vajna 
AuthorDate: Tue Jul 26 08:21:48 2022 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jul 26 09:50:37 2022 +0200

sw content controls, plain text: add insert UI

- handle the plain text case in SwWrtShell::InsertContentControl()

- expose this as a new .uno:InsertPlainTextContentControl command

- add the new uno command to the default & MS-compatible menus

Change-Id: Ie6eb7271f2c1603fb92036e0067b1e6be70d93ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137447
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 7cbd50530d4c..fa208dcd645d 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -667,6 +667,14 @@
   1
 
   
+  
+
+  Insert Plain Text Content Control
+
+
+  1
+
+  
   
 
   Insert Other Objects
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index ec35e740b42f..f456dc2b13ea 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -225,6 +225,7 @@ class SwUINumRuleItem;
 #define FN_CONTENT_CONTROL_PROPERTIES (FN_INSERT + 25)  /* Content control 
properties */
 #define FN_INSERT_PICTURE_CONTENT_CONTROL (FN_INSERT + 26) /* Picture content 
control */
 #define FN_INSERT_DATE_CONTENT_CONTROL (FN_INSERT + 27) /* Date content 
control */
+#define FN_INSERT_PLAIN_TEXT_CONTENT_CONTROL (FN_INSERT + 28) /* Plain text 
content control */
 #define FN_POSTIT   (FN_INSERT + 29)/* Insert/edit PostIt */
 #define FN_INSERT_TABLE (FN_INSERT + 30)/* Insert Table */
 #define FN_INSERT_STRING(FN_INSERT+31)
diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx
index 87537e887242..1caeb749906f 100644
--- a/sw/qa/uibase/wrtsh/wrtsh.cxx
+++ b/sw/qa/uibase/wrtsh/wrtsh.cxx
@@ -367,6 +367,27 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertDateContentControl)
 // handling for date content control.
 CPPUNIT_ASSERT(pContentControl->GetDate());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInsertPlainTextContentControl)
+{
+// Given an empty document:
+SwDoc* pDoc = createSwDoc();
+
+// When inserting a plain text content control:
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertContentControl(SwContentControlType::PLAIN_TEXT);
+
+// Then make sure that the matching text attribute is added to the 
document model:
+SwTextNode* pTextNode = pWrtShell->GetCursor()->GetNode().GetTextNode();
+SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
+auto pTextContentControl = 
static_txtattr_cast(pAttr);
+auto& rFormatContentControl
+= static_cast(pTextContentControl->GetAttr());
+std::shared_ptr pContentControl = 
rFormatContentControl.GetContentControl();
+// Without the accompanying fix in place, this test would have failed, 
there was no special
+// handling for plain text content controls.
+CPPUNIT_ASSERT(pContentControl->GetPlainText());
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index fce2a4df9740..a508445f8dca 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -302,6 +302,12 @@ interface BaseText
 StateMethod = NoState ;
 DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
 ]
+FN_INSERT_PLAIN_TEXT_CONTENT_CONTROL  // status(final|play)
+[
+ExecMethod = ExecInsert ;
+StateMethod = NoState ;
+DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+]
 FN_CONTENT_CONTROL_PROPERTIES  // status(final|play)
 [
 ExecMethod = ExecInsert ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 49fa8f2bb4e6..cd3304860374 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -3117,6 +3117,23 @@ SfxVoidItem 

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2022-05-31 Thread Miklos Vajna (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |8 +++
 sw/inc/cmdid.h  |1 
 sw/inc/strings.hrc  |1 
 sw/qa/uibase/wrtsh/wrtsh.cxx|   21 
++
 sw/sdi/_textsh.sdi  |6 ++
 sw/sdi/swriter.sdi  |   17 

 sw/source/uibase/shells/textsh.cxx  |5 ++
 sw/source/uibase/uiview/view.cxx|1 
 sw/source/uibase/wrtsh/wrtsh1.cxx   |   18 

 sw/uiconfig/swriter/menubar/menubar.xml |1 
 sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml   |2 
 11 files changed, 79 insertions(+), 2 deletions(-)

New commits:
commit 5f335154459e044b6035f099a3e08c98fe258d2b
Author: Miklos Vajna 
AuthorDate: Tue May 31 09:29:54 2022 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 31 14:39:26 2022 +0200

sw content controls, date: add insert UI

- handle the date case in SwWrtShell::InsertContentControl()

- expose this as a new .uno:InsertDateContentControl command

- add the new uno command to the default & MS-compatible menus

- hide the old .uno:DatePickerFormField from the menus that has the
  problems described in the sw::mark::DateFieldmark documentation.

Change-Id: If3c1050d6a8302be0da4a11067a67805396dec48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135153
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 2ca80032ed48..7c7dede5e219 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -659,6 +659,14 @@
   1
 
   
+  
+
+  Insert Date Content Control
+
+
+  1
+
+  
   
 
   Insert Other Objects
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 8b102cae3bf1..ec35e740b42f 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -224,6 +224,7 @@ class SwUINumRuleItem;
 #define FN_INSERT_DROPDOWN_CONTENT_CONTROL (FN_INSERT + 24)  /* Dropdown 
content control */
 #define FN_CONTENT_CONTROL_PROPERTIES (FN_INSERT + 25)  /* Content control 
properties */
 #define FN_INSERT_PICTURE_CONTENT_CONTROL (FN_INSERT + 26) /* Picture content 
control */
+#define FN_INSERT_DATE_CONTENT_CONTROL (FN_INSERT + 27) /* Date content 
control */
 #define FN_POSTIT   (FN_INSERT + 29)/* Insert/edit PostIt */
 #define FN_INSERT_TABLE (FN_INSERT + 30)/* Insert Table */
 #define FN_INSERT_STRING(FN_INSERT+31)
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 4136c2bce029..5a2ff72b0b3b 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1431,6 +1431,7 @@
 #define STR_WRAP_PANEL_CUSTOM_STR   NC_("sidebarwrap|customlabel", 
"Custom")
 #define STR_CONTENT_CONTROL_PLACEHOLDER 
NC_("STR_CONTENT_CONTROL_PLACEHOLDER", "Click here to enter text")
 #define STR_DROPDOWN_CONTENT_CONTROL_PLACEHOLDER 
NC_("STR_DROPDOWN_CONTENT_CONTROL_PLACEHOLDER", "Choose an item")
+#define STR_DATE_CONTENT_CONTROL_PLACEHOLDER 
NC_("STR_DATE_CONTENT_CONTROL_PLACEHOLDER", "Choose a date")
 
 #endif
 
diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx
index 706e1c6653a7..87537e887242 100644
--- a/sw/qa/uibase/wrtsh/wrtsh.cxx
+++ b/sw/qa/uibase/wrtsh/wrtsh.cxx
@@ -346,6 +346,27 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDateContentControl)
 CPPUNIT_ASSERT_EQUAL(OUString("2022-05-24T00:00:00Z"),
  
rFormatContentControl.GetContentControl()->GetCurrentDate());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInsertDateContentControl)
+{
+// Given an empty document:
+SwDoc* pDoc = createSwDoc();
+
+// When inserting a date content control:
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertContentControl(SwContentControlType::DATE);
+
+// Then make sure that the matching text attribute is added to the 
document model:
+SwTextNode* pTextNode = pWrtShell->GetCursor()->GetNode().GetTextNode();
+SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
+auto pTextContentControl = 
static_txtattr_cast(pAttr);
+auto& rFormatContentControl
+= static_cast(pTextContentControl->GetAttr());
+std::shared_ptr pContentControl = 
rFormatContentControl.GetContentControl();
+// Without the accompanying fix in place, this test would have failed, 
there was no special
+// handling for date content control.
+

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2022-05-20 Thread Miklos Vajna (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |8 +
 sw/inc/cmdid.h  |1 
 sw/qa/uibase/wrtsh/wrtsh.cxx|   22 
 sw/sdi/_textsh.sdi  |6 +
 sw/sdi/swriter.sdi  |   17 +++
 sw/source/uibase/dochdl/swdtflvr.cxx|   10 -
 sw/source/uibase/inc/wrtsh.hxx  |2 
 sw/source/uibase/shells/basesh.cxx  |2 
 sw/source/uibase/shells/textsh.cxx  |5 
 sw/source/uibase/uiview/view.cxx|4 
 sw/source/uibase/uiview/view2.cxx   |4 
 sw/source/uibase/wrtsh/wrtsh1.cxx   |   52 
+-
 sw/uiconfig/swriter/menubar/menubar.xml |1 
 sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml   |1 
 14 files changed, 120 insertions(+), 15 deletions(-)

New commits:
commit 73ed5e36047b6f46b3777bf6f36591ec4babb1f9
Author: Miklos Vajna 
AuthorDate: Fri May 20 13:31:45 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 20 16:55:16 2022 +0200

sw content controls, picture: add insert UI

- handle the picture case in SwWrtShell::InsertContentControl(): insert
  a placeholder bitmap & create content control around the as-char image

- expose this as a new .uno:InsertPictureContentControl command

- add the new uno command to the default & MS-compatible menus

- rename the SwWrtShell::Insert() overload taking a Graphic to make this
  a bit more readable

Change-Id: I289d6b6a9cd622c585b6cf0ec0c91d6b51ad81ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134681
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 1dad35cc2190..2ca80032ed48 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -651,6 +651,14 @@
   1
 
   
+  
+
+  Insert Picture Content Control
+
+
+  1
+
+  
   
 
   Insert Other Objects
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 0e1691d7ec2d..8b102cae3bf1 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -223,6 +223,7 @@ class SwUINumRuleItem;
 #define FN_INSERT_PAGEBREAK (FN_INSERT + 23)/* Page break*/
 #define FN_INSERT_DROPDOWN_CONTENT_CONTROL (FN_INSERT + 24)  /* Dropdown 
content control */
 #define FN_CONTENT_CONTROL_PROPERTIES (FN_INSERT + 25)  /* Content control 
properties */
+#define FN_INSERT_PICTURE_CONTENT_CONTROL (FN_INSERT + 26) /* Picture content 
control */
 #define FN_POSTIT   (FN_INSERT + 29)/* Insert/edit PostIt */
 #define FN_INSERT_TABLE (FN_INSERT + 30)/* Insert Table */
 #define FN_INSERT_STRING(FN_INSERT+31)
diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx
index 297e7a2d1ebd..3fd708bf2a48 100644
--- a/sw/qa/uibase/wrtsh/wrtsh.cxx
+++ b/sw/qa/uibase/wrtsh/wrtsh.cxx
@@ -285,6 +285,28 @@ CPPUNIT_TEST_FIXTURE(Test, 
testReplacePictureContentControl)
 // killed the image selection.
 CPPUNIT_ASSERT(pWrtShell->IsFrameSelected());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInsertPictureContentControl)
+{
+// Given an empty document:
+SwDoc* pDoc = createSwDoc();
+
+// When inserting a content control:
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertContentControl(SwContentControlType::PICTURE);
+
+// Then make sure that the matching text attribute is added to the 
document model:
+SwTextNode* pTextNode = pWrtShell->GetCursor()->GetNode().GetTextNode();
+SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
+auto pTextContentControl = 
static_txtattr_cast(pAttr);
+auto& rFormatContentControl
+= static_cast(pTextContentControl->GetAttr());
+std::shared_ptr pContentControl = 
rFormatContentControl.GetContentControl();
+// Without the accompanying fix in place, this test would have failed, 
there was no special
+// handling for picture content control, no placeholder fly content was 
inserted.
+CPPUNIT_ASSERT(pContentControl->GetPicture());
+CPPUNIT_ASSERT(pTextNode->GetTextAttrForCharAt(1, RES_TXTATR_FLYCNT));
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 4c4e042e45a5..6f6ad01a1536 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -290,6 +290,12 @@ interface BaseText
 StateMethod = NoState ;
 

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig xmloff/source

2022-05-12 Thread Miklos Vajna (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |8 +++
 sw/inc/cmdid.h  |3 -
 sw/inc/formatcontentcontrol.hxx |2 
 sw/inc/strings.hrc  |1 
 sw/qa/uibase/wrtsh/wrtsh.cxx|   23 
++
 sw/sdi/_textsh.sdi  |6 ++
 sw/sdi/swriter.sdi  |   17 
+++
 sw/source/core/crsr/dropdowncontentcontrolbutton.cxx|4 +
 sw/source/core/txtnode/attrcontentcontrol.cxx   |   10 
 sw/source/uibase/shells/textsh.cxx  |5 ++
 sw/source/uibase/uiview/view.cxx|1 
 sw/source/uibase/wrtsh/wrtsh1.cxx   |   13 
+
 sw/source/uibase/wrtsh/wrtsh3.cxx   |2 
 sw/uiconfig/swriter/menubar/menubar.xml |1 
 sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml   |3 +
 xmloff/source/text/txtparae.cxx |2 
 16 files changed, 96 insertions(+), 5 deletions(-)

New commits:
commit 9f37840b0d7778ab4fc3294c44f62198ea932e3f
Author: Miklos Vajna 
AuthorDate: Thu May 12 08:17:02 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 12 17:48:51 2022 +0200

sw content controls, dropdown: add insert UI

- introduce a SwContentControlListItem::ToString() that tries to use the
  display text of the list item, otherwise falls back to its value and use 
it
  while building the dropdown widget and when inserting selected list item

- handle the dropdown case in SwWrtShell::InsertContentControl()

- expose this as a new .uno:InsertDropdownContentControl command

- mention the new and all previous content control commands in the
  MS-compatible forms menu as well

Change-Id: I075f77933c1466b5258357d5a661e173c34de34f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134215
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index b36802016c1d..f3181fea0059 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -635,6 +635,14 @@
   1
 
   
+  
+
+  Insert Drop-Down List Content Control
+
+
+  1
+
+  
   
 
   Insert Other Objects
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 355d607a5bc5..a11bfd4e21df 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -217,10 +217,11 @@ class SwUINumRuleItem;
 
 #define FN_INSERT_LINEBREAK (FN_INSERT + 18)/* Newline */
 #define FN_INSERT_FIELD_DATA_ONLY (FN_INSERT + 19)  /* Field dialog for mail 
merge*/
-#define FN_INSERT_CONTENT_CONTROL (FN_INSERT + 20)  /* Content control */
+#define FN_INSERT_CONTENT_CONTROL (FN_INSERT + 20)  /* Rich text content 
control */
 #define FN_INSERT_CHECKBOX_CONTENT_CONTROL (FN_INSERT + 21)  /* Checkbox 
content control */
 #define FN_INSERT_OBJECT_DLG(FN_INSERT + 22)/* Object */
 #define FN_INSERT_PAGEBREAK (FN_INSERT + 23)/* Page break*/
+#define FN_INSERT_DROPDOWN_CONTENT_CONTROL (FN_INSERT + 24)  /* Dropdown 
content control */
 #define FN_POSTIT   (FN_INSERT + 29)/* Insert/edit PostIt */
 #define FN_INSERT_TABLE (FN_INSERT + 30)/* Insert Table */
 #define FN_INSERT_STRING(FN_INSERT+31)
diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index e3debfb77bf4..09797fd00b0a 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -84,6 +84,8 @@ public:
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 
+OUString ToString() const;
+
 static void ItemsToAny(const std::vector& rItems,
css::uno::Any& rVal);
 
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index c19ebe69fc9b..75ffb71a3441 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1430,6 +1430,7 @@
 
 #define STR_WRAP_PANEL_CUSTOM_STR   NC_("sidebarwrap|customlabel", 
"Custom")
 #define STR_CONTENT_CONTROL_PLACEHOLDER 
NC_("STR_CONTENT_CONTROL_PLACEHOLDER", "Click here to enter text")
+#define STR_DROPDOWN_CONTENT_CONTROL_PLACEHOLDER 
NC_("STR_DROPDOWN_CONTENT_CONTROL_PLACEHOLDER", "Choose an item")
 
 #endif
 
diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx
index 72d8e7060de6..2799a8213ead 100644
--- a/sw/qa/uibase/wrtsh/wrtsh.cxx
+++ b/sw/qa/uibase/wrtsh/wrtsh.cxx
@@ -216,6 +216,29 @@ CPPUNIT_TEST_FIXTURE(Test, 

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2022-05-02 Thread Miklos Vajna (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |   13 
 sw/inc/cmdid.h  |1 
 sw/inc/formatcontentcontrol.hxx |6 +
 sw/qa/uibase/wrtsh/wrtsh.cxx|   23 
+++
 sw/sdi/_textsh.sdi  |6 +
 sw/sdi/swriter.sdi  |   17 
+
 sw/source/uibase/inc/wrtsh.hxx  |3 
 sw/source/uibase/shells/textsh.cxx  |8 ++
 sw/source/uibase/uiview/view.cxx|2 
 sw/source/uibase/wrtsh/wrtsh1.cxx   |   31 
--
 sw/uiconfig/swriter/menubar/menubar.xml |7 +-
 11 files changed, 106 insertions(+), 11 deletions(-)

New commits:
commit 02a5bd2e6c4eee50cbd8cb4ed009731c409711a5
Author: Miklos Vajna 
AuthorDate: Mon May 2 08:43:19 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 2 12:54:27 2022 +0200

sw content controls, checkbox: add insert UI

- extend SwWrtShell::InsertContentControl() to be able to create
  multiple content control types

- a new checkbox content control's content is always a non-checked
  checkbox

- expose this as a new .uno:InsertCheckboxContentControl uno command

- add this new command to the bottom of the form menu -- now that we
  have two types of content controls, have that in a sub-menu

Change-Id: I058659600b3face69b89262feb0979fff32521c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133685
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 8835deef87a7..b36802016c1d 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -614,6 +614,11 @@
   1
 
   
+  
+
+  Content Controls
+
+  
   
 
   Insert Rich Text Content Control
@@ -622,6 +627,14 @@
   1
 
   
+  
+
+  Insert Check Box Content Control
+
+
+  1
+
+  
   
 
   Insert Other Objects
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 29adc6a580d6..355d607a5bc5 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -218,6 +218,7 @@ class SwUINumRuleItem;
 #define FN_INSERT_LINEBREAK (FN_INSERT + 18)/* Newline */
 #define FN_INSERT_FIELD_DATA_ONLY (FN_INSERT + 19)  /* Field dialog for mail 
merge*/
 #define FN_INSERT_CONTENT_CONTROL (FN_INSERT + 20)  /* Content control */
+#define FN_INSERT_CHECKBOX_CONTENT_CONTROL (FN_INSERT + 21)  /* Checkbox 
content control */
 #define FN_INSERT_OBJECT_DLG(FN_INSERT + 22)/* Object */
 #define FN_INSERT_PAGEBREAK (FN_INSERT + 23)/* Page break*/
 #define FN_POSTIT   (FN_INSERT + 29)/* Insert/edit PostIt */
diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index 368720a0cb76..8419446f59c0 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -32,6 +32,12 @@ class SwTextContentControl;
 class SwTextNode;
 class SwXContentControl;
 
+enum class SwContentControlType
+{
+RICH_TEXT,
+CHECKBOX,
+};
+
 /// SfxPoolItem subclass that wraps an SwContentControl.
 class SAL_DLLPUBLIC_RTTI SwFormatContentControl final : public SfxPoolItem
 {
diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx
index b4d4cca09df6..5fddff1d884f 100644
--- a/sw/qa/uibase/wrtsh/wrtsh.cxx
+++ b/sw/qa/uibase/wrtsh/wrtsh.cxx
@@ -136,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertContentControl)
 
 // When inserting a content control:
 SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-pWrtShell->InsertContentControl();
+pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT);
 
 // Then make sure that the matching text attribute is added to the 
document model:
 SwTextNode* pTextNode = pWrtShell->GetCursor()->GetNode().GetTextNode();
@@ -144,6 +144,27 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertContentControl)
 // InsertContentControl().
 CPPUNIT_ASSERT(pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL));
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControl)
+{
+// Given an empty document:
+SwDoc* pDoc = createSwDoc();
+
+// When inserting a content control:
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX);
+
+// Then make sure that the matching text attribute is added to the 
document model:
+SwTextNode* pTextNode 

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2022-04-21 Thread Miklos Vajna (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |8 +++
 sw/inc/cmdid.h  |1 
 sw/inc/strings.hrc  |1 
 sw/qa/uibase/wrtsh/wrtsh.cxx|   16 
++
 sw/sdi/_textsh.sdi  |6 ++
 sw/sdi/swriter.sdi  |   17 
++
 sw/source/uibase/inc/wrtsh.hxx  |1 
 sw/source/uibase/shells/textsh.cxx  |5 +
 sw/source/uibase/uiview/view.cxx|2 
 sw/source/uibase/wrtsh/wrtsh1.cxx   |   26 
++
 sw/uiconfig/swriter/menubar/menubar.xml |2 
 11 files changed, 84 insertions(+), 1 deletion(-)

New commits:
commit 59393b73ec4c0f1f1965a9c24a2635780c707189
Author: Miklos Vajna 
AuthorDate: Thu Apr 21 09:08:03 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Apr 21 10:29:17 2022 +0200

sw content controls: add insert UI

- add an SwWrtShell::InsertContentControl() to put the current selection
  into a content control

- if there is no selection, add a non-empty placeholder

- expose this as a new .uno:InsertContentControl uno command

- add this new command to the bottom of the form menu -- probably we can
  have a sub-menu there once there will be more types

Change-Id: Icb32aee777ab08d09401bf468788692b933a90ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133241
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 9ca5a77217b4..1d1a3f759d9f 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -614,6 +614,14 @@
   1
 
   
+  
+
+  Insert Rich Text Content Control
+
+
+  1
+
+  
   
 
   Insert Other Objects
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 27a3763c1d64..df1321bb00e9 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -217,6 +217,7 @@ class SwUINumRuleItem;
 
 #define FN_INSERT_LINEBREAK (FN_INSERT + 18)/* Newline */
 #define FN_INSERT_FIELD_DATA_ONLY (FN_INSERT + 19)  /* Field dialog for mail 
merge*/
+#define FN_INSERT_CONTENT_CONTROL (FN_INSERT + 20)  /* Content control */
 #define FN_INSERT_OBJECT_DLG(FN_INSERT + 22)/* Object */
 #define FN_INSERT_PAGEBREAK (FN_INSERT + 23)/* Page break*/
 #define FN_POSTIT   (FN_INSERT + 29)/* Insert/edit PostIt */
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 1258f55801af..548795c82e61 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1427,6 +1427,7 @@
 #define STR_AUTOMARK_NO NC_("createautomarkdialog|no", 
"No")
 
 #define STR_WRAP_PANEL_CUSTOM_STR   NC_("sidebarwrap|customlabel", 
"Custom")
+#define STR_CONTENT_CONTROL_PLACEHOLDER 
NC_("STR_CONTENT_CONTROL_PLACEHOLDER", "Click here to enter text")
 
 #endif
 
diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx
index d73ba55ef09f..51489553d30f 100644
--- a/sw/qa/uibase/wrtsh/wrtsh.cxx
+++ b/sw/qa/uibase/wrtsh/wrtsh.cxx
@@ -90,6 +90,22 @@ CPPUNIT_TEST_FIXTURE(Test, testGotoContentControl)
 sal_Int32 nEnd = pWrtShell->GetCursor()->End()->nContent.GetIndex();
 CPPUNIT_ASSERT_EQUAL(static_cast(5), nEnd);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInsertContentControl)
+{
+// Given an empty document:
+SwDoc* pDoc = createSwDoc();
+
+// When inserting a content control:
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertContentControl();
+
+// Then make sure that the matching text attribute is added to the 
document model:
+SwTextNode* pTextNode = pWrtShell->GetCursor()->GetNode().GetTextNode();
+// Without the accompanying fix in place, this test would have failed, 
nothing happened on
+// InsertContentControl().
+CPPUNIT_ASSERT(pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL));
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index c30d3b2057ea..7610800f2cc4 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -272,6 +272,12 @@ interface BaseText
 StateMethod = NoState ;
 DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
 ]
+FN_INSERT_CONTENT_CONTROL  // status(final|play)
+[
+ExecMethod = ExecInsert ;
+StateMethod = NoState ;
+DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+]
 FN_INSERT_COLUMN_BREAK // status(final|play)
 [
 

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2021-07-22 Thread Miklos Vajna (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |8 +
 sw/inc/cmdid.h   |1 
 sw/qa/uibase/shells/shells.cxx   |   38 
+
 sw/sdi/_textsh.sdi   |5 +
 sw/sdi/swriter.sdi   |   17 

 sw/source/uibase/shells/textsh1.cxx  |   41 
++
 sw/uiconfig/swriter/popupmenu/text.xml   |1 
 7 files changed, 111 insertions(+)

New commits:
commit b85becd0d427c7375f1d8e6309f348304b6ebbac
Author: Miklos Vajna 
AuthorDate: Thu Jul 22 14:23:07 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jul 22 16:21:49 2021 +0200

sw bibliography, local copy: add context menu

This way in case a bibliography entry (field) has both a URL and a
LocalURL, it is possible to choose which one should be opened when the
context menu is used on the field. This is meant to be the primary way
the user consumes this information.

Change-Id: I21b72505f8387943424665bff70905f774771d4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119373
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index eb8d07581cca..7015b06c306e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -7249,6 +7249,14 @@ bit 3 (0x8): #define 
UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
   1
 
   
+  
+
+  ~Open Local Copy
+
+
+  1
+
+  
   
 
   ~Edit Chart
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 198aaded1608..79b6ffc392ba 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -495,6 +495,7 @@
 #define FN_CHANGE_PAGENUM   (FN_EXTRA + 34)   /* change page numbers*/
 #define FN_ADD_TEXT_BOX (FN_EXTRA + 35)   /* add text box to draw 
shape */
 #define FN_REMOVE_TEXT_BOX  (FN_EXTRA + 36)   /* remove text box of 
draw shape */
+#define FN_OPEN_LOCAL_URL   (FN_EXTRA + 37)   /* open local copy for 
bibliography */
 
 //  Region: Glossary
 
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index badc17d1f4ce..e1f5d048c018 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -170,6 +170,44 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, 
testBibliographyUrlContextMenu)
 CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, eState);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu)
+{
+// Given a document with a bibliography field's local copy:
+SwDoc* pDoc = createSwDoc();
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xField(
+xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), 
uno::UNO_QUERY);
+uno::Sequence aFields = {
+comphelper::makePropertyValue("BibiliographicType", 
text::BibliographyDataType::WWW),
+comphelper::makePropertyValue("Identifier", OUString("AT")),
+comphelper::makePropertyValue("Author", OUString("Author")),
+comphelper::makePropertyValue("Title", OUString("Title")),
+comphelper::makePropertyValue("URL", 
OUString("http://www.example.com/test.pdf#page=1;)),
+comphelper::makePropertyValue("LocalURL", 
OUString("file:///home/me/test.pdf")),
+};
+xField->setPropertyValue("Fields", uno::makeAny(aFields));
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+uno::Reference xContent(xField, uno::UNO_QUERY);
+xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false);
+
+// When selecting the field and opening the context menu:
+SwDocShell* pDocShell = pDoc->GetDocShell();
+SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+SfxDispatcher* pDispatcher = 
pDocShell->GetViewShell()->GetViewFrame()->GetDispatcher();
+css::uno::Any aState;
+SfxItemState eState = pDispatcher->QueryState(FN_OPEN_LOCAL_URL, aState);
+
+// Then the "open local copy" menu item should be visible:
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 32 (SfxItemState::DEFAULT)
+// - Actual  : 1 (SfxItemState::DISABLED)
+// i.e. the context menu was disabled all the time, even for biblio fields.
+CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, eState);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git 

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2019-07-11 Thread Tamás Zolnai (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |8 ++
 sw/inc/cmdid.h   |2 
 sw/qa/extras/uiwriter/uiwriter2.cxx  |   32 
++
 sw/sdi/_textsh.sdi   |6 +
 sw/sdi/swriter.sdi   |   18 
+
 sw/source/uibase/shells/textfld.cxx  |   16 
+
 sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml|2 
 7 files changed, 83 insertions(+), 1 deletion(-)

New commits:
commit 75099d6788672a98389d8592b88777c8d3a25fa6
Author: Tamás Zolnai 
AuthorDate: Fri May 31 17:55:10 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Fri Jul 12 01:04:13 2019 +0200

MSForms: Insert text-based date field from MS compatible Forms menu

Change-Id: I2f08fa806dc55a185adf67ca616af8d81bb23bda
Reviewed-on: https://gerrit.libreoffice.org/75438
Reviewed-by: Tamás Zolnai 
Tested-by: Tamás Zolnai 

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 1cb1a4f76d98..44654837f894 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6395,6 +6395,14 @@
   1
 
   
+  
+
+  Date Picker Content Control
+
+
+  1
+
+  
 
 
   
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 9ad470acddc2..0a8191ce59bd 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -277,6 +277,8 @@
 #define FN_INSERT_CHECKBOX_FORMFIELD(FN_INSERT2 + 23)
 #define FN_INSERT_DROPDOWN_FORMFIELD(FN_INSERT2 + 24)
 
+// MSO content controls
+#define FN_INSERT_DATE_FORMFIELD(FN_INSERT2 + 25)
 
 // Region: Format
 #define FN_AUTOFORMAT_APPLY (FN_FORMAT + 1 ) /* apply autoformat options */
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index b9244ac94d46..887e59e73b06 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1765,4 +1765,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testShapePageMove)
 CPPUNIT_ASSERT_EQUAL(nNodeIndex, pAnchor->nNode.GetIndex());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldInsertion)
+{
+SwDoc* pDoc = createDoc();
+CPPUNIT_ASSERT(pDoc);
+IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
+CPPUNIT_ASSERT(pMarkAccess);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
+
+// Insert a date form field
+lcl_dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
+
+// Check whether the fieldmark is created
+auto aIter = pMarkAccess->getAllMarksBegin();
+CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
+::sw::mark::IFieldmark* pFieldmark = 
dynamic_cast<::sw::mark::IFieldmark*>(*aIter);
+CPPUNIT_ASSERT(pFieldmark);
+CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDATE), pFieldmark->GetFieldname());
+
+// Undo insertion
+lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
+
+// Redo insertion
+lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+aIter = pMarkAccess->getAllMarksBegin();
+CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
+pFieldmark = dynamic_cast<::sw::mark::IFieldmark*>(*aIter);
+CPPUNIT_ASSERT(pFieldmark);
+CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDATE), pFieldmark->GetFieldname());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index e90b752eec17..7884565ad03a 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1705,6 +1705,12 @@ interface BaseText
 StateMethod = StateField ;
 ]
 
+FN_INSERT_DATE_FORMFIELD
+[
+ExecMethod = ExecField ;
+StateMethod = StateField ;
+]
+
 SID_FM_CTL_PROPERTIES
 [
 ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 9ccc84af77ff..6e04a0a0884f 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -7771,3 +7771,21 @@ SfxVoidItem DropDownFormField 
FN_INSERT_DROPDOWN_FORMFIELD
 ToolBoxConfig = TRUE,
 GroupId = SfxGroupId::Controls;
 ]
+
+SfxVoidItem DatePickerFormField FN_INSERT_DATE_FORMFIELD
+
+[
+AutoUpdate = TRUE,
+FastCall = FALSE,
+ReadOnlyDoc = FALSE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+
+
+AccelConfig = TRUE,
+MenuConfig = TRUE,
+ToolBoxConfig = TRUE,
+GroupId = SfxGroupId::Controls;
+]
diff --git a/sw/source/uibase/shells/textfld.cxx 
b/sw/source/uibase/shells/textfld.cxx
index