[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - 3 commits - desktop/source libreofficekit/qa sfx2/source

Pranav Kant pranavk at collabora.co.uk
Mon Jan 23 07:15:53 UTC 2017


 desktop/source/lib/init.cxx                         |    3 +++
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |    6 ++++++
 sfx2/source/control/unoctitm.cxx                    |    5 ++++-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit dc0f5b50bd73d1afce156e84311d2bd2f4035fae
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Sat Jan 21 01:03:34 2017 +0530

    lok: Listen for state change events for cell alignment commands
    
    We used to use HorizontalAlignment uno command for cell alignment
    both in online and gtktiledviewer. To make things simpler, lets
    use separate cell alignment uno commands for spreadsheets like we
    have in writer and impres.
    
    Change-Id: I2a959d1892f6b02db7a9ce51d55309216e4b3c6c
    Reviewed-on: https://gerrit.libreoffice.org/33444
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit a27e09079596eeae81cced01eaeabf94d6675085)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 62d8d34..66608a6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1241,6 +1241,9 @@ static void doc_iniUnoCommands ()
 
     OUString sUnoCommands[] =
     {
+        OUString(".uno:AlignLeft"),
+        OUString(".uno:AlignHorizontalCenter"),
+        OUString(".uno:AlignRight"),
         OUString(".uno:BackColor"),
         OUString(".uno:BackgroundColor"),
         OUString(".uno:Bold"),
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 28da6c5..2f1ce85 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -365,18 +365,11 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi
         gtk_widget_queue_draw(rWindow.m_pColumnBar->m_pDrawingArea);
         gtk_widget_show(rWindow.m_pFormulabarEntry);
 
-        // Change horizontal alignment uno commands for spreadsheet
-        const std::string argsPrefix =
-            "{"
-            "\"HorizontalAlignment\":{"
-            "\"type\":\"unsigned short\", "
-            "\"value\":\"";
-        const std::string argsSuffix = "\"}}";
-
-        lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(1) + argsSuffix);
-        lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(2) + argsSuffix);
-        lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(3) + argsSuffix);
-        lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(4) + argsSuffix);
+        // Change cell alignment uno commands for spreadsheet
+        lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:AlignLeft");
+        lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:AlignHorizontalCenter");
+        lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:AlignRight");
+        gtk_widget_hide(GTK_WIDGET(rWindow.m_pJustifypara));
     }
 
     return TRUE;
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 063f808..2e4d18f 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1120,7 +1120,10 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c
         aEvent.FeatureURL.Path == "Underline" ||
         aEvent.FeatureURL.Path == "ModifiedStatus" ||
         aEvent.FeatureURL.Path == "TrackChanges" ||
-        aEvent.FeatureURL.Path == "AcceptTrackedChange")
+        aEvent.FeatureURL.Path == "AcceptTrackedChange" ||
+        aEvent.FeatureURL.Path == "AlignLeft" ||
+        aEvent.FeatureURL.Path == "AlignHorizontalCenter" ||
+        aEvent.FeatureURL.Path == "AlignRight")
     {
         bool bTemp = false;
         aEvent.State >>= bTemp;
commit 3eb2ed31565c8431fab30f153ccc243353e77975
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jan 6 15:57:43 2017 +0530

    gtktiledviewer: Lets avoid using manual buffer sizes
    
    Change-Id: I76e70ccb5b1f40193a1eda1cbca19b3444168dae
    (cherry picked from commit 29f697711e06b88fb8387518e7f8440cf49f0933)

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 756ff17..28da6c5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -366,23 +366,17 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi
         gtk_widget_show(rWindow.m_pFormulabarEntry);
 
         // Change horizontal alignment uno commands for spreadsheet
-        const char* unoHorAlignArgs =
+        const std::string argsPrefix =
             "{"
             "\"HorizontalAlignment\":{"
             "\"type\":\"unsigned short\", "
-            "\"value\":\"%d\""
-            "}"
-            "}";
-
-        char unoHorAlignArgsFormatted[strlen(unoHorAlignArgs)];
-        snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 1);
-        lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
-        snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 2);
-        lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
-        snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 3);
-        lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
-        snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 4);
-        lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
+            "\"value\":\"";
+        const std::string argsSuffix = "\"}}";
+
+        lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(1) + argsSuffix);
+        lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(2) + argsSuffix);
+        lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(3) + argsSuffix);
+        lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, ".uno:HorizontalAlignment", argsPrefix + std::to_string(4) + argsSuffix);
     }
 
     return TRUE;
commit 463d5d2c0e772a856ab9d0fe079b0a19cc45254c
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jan 6 14:27:27 2017 +0530

    gtktiledviewer: Override alignment buttons uno commands for calc
    
    Use .uno:HorizontalAlignment instead of .uno:XXXPara for calc
    
    Change-Id: I5af4fe62dc3075af4ba779499d062e6d91f21ecf
    Reviewed-on: https://gerrit.libreoffice.org/32773
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit 6ccd698371a8e88ea06ed0e144171dd1b6236aa7)

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 3a19c21..756ff17 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -364,6 +364,25 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi
         gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea);
         gtk_widget_queue_draw(rWindow.m_pColumnBar->m_pDrawingArea);
         gtk_widget_show(rWindow.m_pFormulabarEntry);
+
+        // Change horizontal alignment uno commands for spreadsheet
+        const char* unoHorAlignArgs =
+            "{"
+            "\"HorizontalAlignment\":{"
+            "\"type\":\"unsigned short\", "
+            "\"value\":\"%d\""
+            "}"
+            "}";
+
+        char unoHorAlignArgsFormatted[strlen(unoHorAlignArgs)];
+        snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 1);
+        lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
+        snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 2);
+        lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
+        snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 3);
+        lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
+        snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), unoHorAlignArgs, 4);
+        lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, ".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
     }
 
     return TRUE;


More information about the Libreoffice-commits mailing list