summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2019-07-03 15:33:35 +0300
committerJustin Luth <justin_luth@sil.org>2019-07-22 06:07:29 +0200
commit82c3e68642de445064313e353812b54df76c7fe9 (patch)
treeaffbde4996b940f506cd40409fc077d095b11f01 /sd
parent382aceb80d3c0f420d51762e1f88eee2334ff11b (diff)
tdf#118370 Draw: add option to consolidate multiple textObjs
This gives the user a tool to consolidate multiple textboxes into a single textbox. First the user selects a group of textframes, and then runs the consolidate text function. This will REPLACE the marked textframes with a single textbox combining all of the text. The function inspects the text fragments to see if they end in sentence-ending punctuation. If not, then the next textbox's content is appended to it instead of starting a new pargraph. It is the user's responsibility to afterwards fix up paragraphing, and set paragraph properties. The rational for this patch is to simplify making major text changes on PDFs imported into Draw, since each paragraph is currently broken into tiny character-property textbox fragments. Copy/paste from the PDF itself doesn't keep character attributes, so it is hard for a user to re-create the text. This is related to tdf#32249, but as a comment says, a better solution would be to write an entire text-focused PDF import, rather than just pick up the pieces. And I agree, but considering this simple patch took me a couple of weeks of frustration, I'm obviously not the person to do that. And since the bug has been open for 9 years, likely no one else will either. Thus, this pick-up-the-pieces tool to help the end user. This initial patch works only with textFrames, but can easily be adjusted to consolidate other HasText() SdrObjects. However, that tended to produce unexpected results, so everything other than OBJ_TEXT is explicitly excluded. (Thus general shapes with text, callouts, text-along-path etc are ignored.) Change-Id: I68a9a5b187bf320a8e671414c5cb22b07725fd52 Reviewed-on: https://gerrit.libreoffice.org/75043 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/app.hrc1
-rw-r--r--sd/sdi/_drvwsh.sdi5
-rw-r--r--sd/sdi/sdraw.sdi17
-rw-r--r--sd/source/ui/view/drviews2.cxx23
-rw-r--r--sd/source/ui/view/drviewsj.cxx2
-rw-r--r--sd/uiconfig/sdraw/menubar/menubar.xml2
-rw-r--r--sd/uiconfig/sdraw/popupmenu/multiselect.xml1
7 files changed, 51 insertions, 0 deletions
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 2738085f0ae5..9445f47cd0a7 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -94,6 +94,7 @@
// FREE
#define SID_POSITION (SID_SD_START+22)
// FREE
+#define SID_TEXT_COMBINE (SID_SD_START+25)
#define SID_COMBINE (SID_SD_START+26)
#define SID_NAME_GROUP (SID_SD_START+27)
#define SID_DRAWTBX_CONNECTORS (SID_SD_START+28)
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 8dfdf71023de..3c98b281347f 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -469,6 +469,11 @@ interface DrawView
StateMethod = GetMenuState ;
FastCall = FALSE ;
]
+ SID_TEXT_COMBINE // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
SID_COMBINE // ole : no, status : ?
[
ExecMethod = FuTemporary ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index b1760f31bb3b..ad88ee8a09ab 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -330,6 +330,23 @@ SfxBoolItem ColorView SID_COLORVIEW
GroupId = SfxGroupId::View;
]
+SfxVoidItem TextCombine SID_TEXT_COMBINE
+()
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Modify;
+]
+
SfxVoidItem Combine SID_COMBINE
()
[
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index a812d3be34f4..11025537247f 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2598,6 +2598,29 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
}
break;
+ case SID_TEXT_COMBINE: // BASIC
+ {
+ // End text edit to avoid conflicts
+ if(mpDrawView->IsTextEdit())
+ mpDrawView->SdrEndTextEdit();
+
+ if ( mpDrawView->IsPresObjSelected() )
+ {
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Info, VclButtonsType::Ok,
+ SdResId(STR_ACTION_NOTPOSSIBLE)));
+ xInfoBox->run();
+ }
+ else
+ {
+ WaitObject aWait( GetActiveWindow() );
+ mpDrawView->CombineMarkedTextObjects();
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
case SID_COMBINE: // BASIC
{
// End text edit to avoid conflicts
diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx
index 32e05aefa4da..92917a72bf67 100644
--- a/sd/source/ui/view/drviewsj.cxx
+++ b/sd/source/ui/view/drviewsj.cxx
@@ -285,6 +285,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
}
rSet.DisableItem(SID_GROUP);
+ rSet.DisableItem(SID_TEXT_COMBINE);
rSet.DisableItem(SID_COMBINE);
rSet.DisableItem(SID_DISTRIBUTE_DLG);
rSet.DisableItem(SID_POLY_MERGE);
@@ -493,6 +494,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
rSet.DisableItem( SID_DISMANTLE );
rSet.DisableItem( SID_BREAK );
+ rSet.DisableItem( SID_TEXT_COMBINE );
rSet.DisableItem( SID_COMBINE );
rSet.DisableItem(SID_DISTRIBUTE_DLG);
rSet.DisableItem(SID_POLY_MERGE);
diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml
index e8f139cb900a..579869a296b4 100644
--- a/sd/uiconfig/sdraw/menubar/menubar.xml
+++ b/sd/uiconfig/sdraw/menubar/menubar.xml
@@ -548,6 +548,8 @@
<menu:menuitem menu:id=".uno:Substract"/>
<menu:menuitem menu:id=".uno:Intersect"/>
<menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:TextCombine"/>
+ <menu:menuseparator/>
<menu:menuitem menu:id=".uno:CopyObjects"/>
<menu:menuitem menu:id=".uno:Morphing"/>
<menu:menuseparator/>
diff --git a/sd/uiconfig/sdraw/popupmenu/multiselect.xml b/sd/uiconfig/sdraw/popupmenu/multiselect.xml
index cb88b0d81eae..86639b8ea309 100644
--- a/sd/uiconfig/sdraw/popupmenu/multiselect.xml
+++ b/sd/uiconfig/sdraw/popupmenu/multiselect.xml
@@ -73,6 +73,7 @@
<menu:menuitem menu:id=".uno:EqualizeHeight"/>
</menu:menupopup>
</menu:menu>
+ <menu:menuitem menu:id=".uno:TextCombine"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:FormatGroup"/>
<menu:menuitem menu:id=".uno:FormatUngroup"/>