[Libreoffice-commits] core.git: libreofficekit/qa
Pranav Kant
pranavk at collabora.co.uk
Fri Jan 6 10:29:59 UTC 2017
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 22 +++++++-------------
1 file changed, 8 insertions(+), 14 deletions(-)
New commits:
commit 29f697711e06b88fb8387518e7f8440cf49f0933
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
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 3382987..3c774c1 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -375,23 +375,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;
More information about the Libreoffice-commits
mailing list