[Libreoffice-commits] core.git: 5 commits - chart2/source chart2/uiconfig cui/source cui/uiconfig extras/source include/svx include/vcl svx/Library_svx.mk svx/source vcl/source
Caolán McNamara
caolanm at redhat.com
Thu Sep 25 09:21:06 PDT 2014
chart2/source/controller/dialogs/res_DataLabel.hxx | 3
chart2/source/controller/dialogs/tp_AxisLabel.hxx | 3
chart2/source/controller/dialogs/tp_TitleRotation.hxx | 3
chart2/uiconfig/ui/dlg_DataLabel.ui | 183 +++++++++---------
chart2/uiconfig/ui/titlerotationtabpage.ui | 2
chart2/uiconfig/ui/tp_DataLabel.ui | 6
chart2/uiconfig/ui/tp_PolarOptions.ui | 7
chart2/uiconfig/ui/tp_axisLabel.ui | 6
cui/source/inc/align.hxx | 3
cui/uiconfig/ui/cellalignment.ui | 2
extras/source/glade/libreoffice-catalog.xml.in | 3
include/svx/wrapfield.hxx | 50 ----
include/vcl/field.hxx | 3
svx/Library_svx.mk | 1
svx/source/dialog/wrapfield.cxx | 51 -----
vcl/source/control/field.cxx | 47 +---
vcl/source/gdi/cvtsvm.cxx | 3
vcl/source/window/menu.cxx | 2
18 files changed, 135 insertions(+), 243 deletions(-)
New commits:
commit 892a7be963f5ffdb5af86a9de1cf8a613fbdc162
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 25 15:36:40 2014 +0100
Resolves: fdo#83010 remove svx::WrapField
in favour of a wrap property on NumericField
Change-Id: I62c6bdb69a16f37ae6018a2fe41070fb18dbe4a0
diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx
index 0044e4a..9d6d0e0 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.hxx
@@ -26,7 +26,6 @@
#include <svl/itemset.hxx>
#include "TextDirectionListBox.hxx"
#include <svx/dialcontrol.hxx>
-#include <svx/wrapfield.hxx>
#include <sfx2/tabdlg.hxx>
class SvNumberFormatter;
@@ -64,7 +63,7 @@ private:
VclHBox* m_pBxOrientation;
svx::DialControl* m_pDC_Dial;
FixedText* m_pFT_Dial;
- svx::WrapField* m_pNF_Degrees;
+ NumericField* m_pNF_Degrees;
VclHBox* m_pBxTextDirection;
TextDirectionListBox* m_pLB_TextDirection;
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
index 059215b..8da5eaf 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
@@ -23,7 +23,6 @@
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <svx/dialcontrol.hxx>
-#include <svx/wrapfield.hxx>
#include <svx/orienthelper.hxx>
#include "TextDirectionListBox.hxx"
@@ -51,7 +50,7 @@ private:
FixedText* m_pFlOrient;
svx::DialControl* m_pCtrlDial;
FixedText* m_pFtRotate;
- svx::WrapField* m_pNfRotate;
+ NumericField* m_pNfRotate;
TriStateBox* m_pCbStacked;
svx::OrientationHelper* m_pOrientHlp;
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
index dd3ceb0..0bd5c97 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -21,7 +21,6 @@
#include <sfx2/tabdlg.hxx>
#include <svx/dialcontrol.hxx>
-#include <svx/wrapfield.hxx>
#include <svx/orienthelper.hxx>
#include <vcl/fixed.hxx>
#include "TextDirectionListBox.hxx"
@@ -34,7 +33,7 @@ class SchAlignmentTabPage : public SfxTabPage
private:
svx::DialControl* m_pCtrlDial;
FixedText* m_pFtRotate;
- svx::WrapField* m_pNfRotate;
+ NumericField* m_pNfRotate;
TriStateBox* m_pCbStacked;
svx::OrientationHelper* m_pOrientHlp;
FixedText* m_pFtTextDirection;
diff --git a/chart2/uiconfig/ui/dlg_DataLabel.ui b/chart2/uiconfig/ui/dlg_DataLabel.ui
index 2910aba..cd35953 100644
--- a/chart2/uiconfig/ui/dlg_DataLabel.ui
+++ b/chart2/uiconfig/ui/dlg_DataLabel.ui
@@ -1,12 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkAdjustment" id="adjustmentDEGREE">
<property name="upper">359</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkListStore" id="liststorePLACEMENT">
+ <columns>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ <!-- column-name guint1 -->
+ <column type="guint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Best fit</col>
+ <col id="1">0</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Center</col>
+ <col id="1">1</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Above</col>
+ <col id="1">2</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Top left</col>
+ <col id="1">3</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Left</col>
+ <col id="1">4</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Bottom left</col>
+ <col id="1">5</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Below</col>
+ <col id="1">6</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Bottom right</col>
+ <col id="1">7</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Right</col>
+ <col id="1">8</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Top right</col>
+ <col id="1">9</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Inside</col>
+ <col id="1">10</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Outside</col>
+ <col id="1">11</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Near origin</col>
+ <col id="1">12</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="liststoreSEPARATOR">
+ <columns>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ <!-- column-name guint1 -->
+ <column type="guint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Space</col>
+ <col id="1">0</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Comma</col>
+ <col id="1">1</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Semicolon</col>
+ <col id="1">2</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">New line</col>
+ <col id="1">3</col>
+ </row>
+ </data>
+ </object>
<object class="GtkDialog" id="dlg_DataLabels">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@@ -366,13 +455,13 @@
</packing>
</child>
<child>
- <object class="svxlo-WrapField" id="NF_LABEL_DEGREES">
+ <object class="GtkSpinButton" id="NF_LABEL_DEGREES">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="invisible_char">â¢</property>
- <property name="invisible_char_set">True</property>
<property name="adjustment">adjustmentDEGREE</property>
+ <property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -474,94 +563,6 @@
<action-widget response="0">help</action-widget>
</action-widgets>
</object>
- <object class="GtkListStore" id="liststorePLACEMENT">
- <columns>
- <!-- column-name gchararray1 -->
- <column type="gchararray"/>
- <!-- column-name guint1 -->
- <column type="guint"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Best fit</col>
- <col id="1">0</col>
- </row>
- <row>
- <col id="0" translatable="yes">Center</col>
- <col id="1">1</col>
- </row>
- <row>
- <col id="0" translatable="yes">Above</col>
- <col id="1">2</col>
- </row>
- <row>
- <col id="0" translatable="yes">Top left</col>
- <col id="1">3</col>
- </row>
- <row>
- <col id="0" translatable="yes">Left</col>
- <col id="1">4</col>
- </row>
- <row>
- <col id="0" translatable="yes">Bottom left</col>
- <col id="1">5</col>
- </row>
- <row>
- <col id="0" translatable="yes">Below</col>
- <col id="1">6</col>
- </row>
- <row>
- <col id="0" translatable="yes">Bottom right</col>
- <col id="1">7</col>
- </row>
- <row>
- <col id="0" translatable="yes">Right</col>
- <col id="1">8</col>
- </row>
- <row>
- <col id="0" translatable="yes">Top right</col>
- <col id="1">9</col>
- </row>
- <row>
- <col id="0" translatable="yes">Inside</col>
- <col id="1">10</col>
- </row>
- <row>
- <col id="0" translatable="yes">Outside</col>
- <col id="1">11</col>
- </row>
- <row>
- <col id="0" translatable="yes">Near origin</col>
- <col id="1">12</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="liststoreSEPARATOR">
- <columns>
- <!-- column-name gchararray1 -->
- <column type="gchararray"/>
- <!-- column-name guint1 -->
- <column type="guint"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Space</col>
- <col id="1">0</col>
- </row>
- <row>
- <col id="0" translatable="yes">Comma</col>
- <col id="1">1</col>
- </row>
- <row>
- <col id="0" translatable="yes">Semicolon</col>
- <col id="1">2</col>
- </row>
- <row>
- <col id="0" translatable="yes">New line</col>
- <col id="1">3</col>
- </row>
- </data>
- </object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
<widget name="FT_TEXT_SEPARATOR"/>
diff --git a/chart2/uiconfig/ui/titlerotationtabpage.ui b/chart2/uiconfig/ui/titlerotationtabpage.ui
index 7ee9e7a..6e0eb43 100644
--- a/chart2/uiconfig/ui/titlerotationtabpage.ui
+++ b/chart2/uiconfig/ui/titlerotationtabpage.ui
@@ -33,7 +33,7 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <object class="svxlo-WrapField" id="OrientDegree">
+ <object class="GtkSpinButton" id="OrientDegree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_top">40</property>
diff --git a/chart2/uiconfig/ui/tp_DataLabel.ui b/chart2/uiconfig/ui/tp_DataLabel.ui
index 798c935..b31bb2e 100644
--- a/chart2/uiconfig/ui/tp_DataLabel.ui
+++ b/chart2/uiconfig/ui/tp_DataLabel.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkAdjustment" id="adjustmentDEGREE">
<property name="upper">359</property>
@@ -387,12 +388,13 @@
</packing>
</child>
<child>
- <object class="svxlo-WrapField" id="NF_LABEL_DEGREES">
+ <object class="GtkSpinButton" id="NF_LABEL_DEGREES">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="invisible_char">â¢</property>
<property name="adjustment">adjustmentDEGREE</property>
+ <property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/chart2/uiconfig/ui/tp_PolarOptions.ui b/chart2/uiconfig/ui/tp_PolarOptions.ui
index edf84f0..6f5d8d8 100644
--- a/chart2/uiconfig/ui/tp_PolarOptions.ui
+++ b/chart2/uiconfig/ui/tp_PolarOptions.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkAdjustment" id="adjustmentDEGREE">
<property name="upper">359</property>
@@ -85,13 +86,13 @@
</packing>
</child>
<child>
- <object class="svxlo-WrapField" id="NF_STARTING_ANGLE">
+ <object class="GtkSpinButton" id="NF_STARTING_ANGLE">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="invisible_char">â¢</property>
- <property name="invisible_char_set">True</property>
<property name="adjustment">adjustmentDEGREE</property>
+ <property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/chart2/uiconfig/ui/tp_axisLabel.ui b/chart2/uiconfig/ui/tp_axisLabel.ui
index 4727c9d..74d6fa5 100644
--- a/chart2/uiconfig/ui/tp_axisLabel.ui
+++ b/chart2/uiconfig/ui/tp_axisLabel.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkAdjustment" id="adjustmentSpinDegrees">
<property name="upper">359</property>
@@ -255,12 +256,11 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <object class="svxlo-WrapField" id="OrientDegree">
+ <object class="GtkSpinButton" id="OrientDegree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_top">40</property>
<property name="invisible_char">â¢</property>
- <property name="invisible_char_set">True</property>
<property name="progress_pulse_step">1</property>
<property name="adjustment">adjustmentSpinDegrees</property>
<property name="wrap">True</property>
diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx
index bb249b5..fb5e07e 100644
--- a/cui/source/inc/align.hxx
+++ b/cui/source/inc/align.hxx
@@ -45,7 +45,6 @@
#include <sfx2/tabdlg.hxx>
#include <svtools/valueset.hxx>
#include <svx/dialcontrol.hxx>
-#include <svx/wrapfield.hxx>
#include <svx/frmdirlbox.hxx>
namespace svx {
@@ -86,7 +85,7 @@ private:
DialControl* m_pCtrlDial;
FixedText* m_pFtRotate;
- WrapField* m_pNfRotate;
+ NumericField* m_pNfRotate;
FixedText* m_pFtRefEdge;
ValueSet* m_pVsRefEdge;
TriStateBox* m_pCbStacked;
diff --git a/cui/uiconfig/ui/cellalignment.ui b/cui/uiconfig/ui/cellalignment.ui
index c455728..9e754e3 100644
--- a/cui/uiconfig/ui/cellalignment.ui
+++ b/cui/uiconfig/ui/cellalignment.ui
@@ -79,7 +79,7 @@
</packing>
</child>
<child>
- <object class="svxlo-WrapField" id="spinDegrees">
+ <object class="GtkSpinButton" id="spinDegrees">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">â¢</property>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 98e5e26..2d1bb24 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -591,9 +591,6 @@
<glade-widget-class title="Sidebar Dial Control" name="svxlo-SidebarDialControl"
generic-name="Sidebar Dial Control" parent="GtkSpinner"
icon-name="widget-gtk-spinner"/>
- <glade-widget-class title="Wrap Field" name="svxlo-WrapField"
- generic-name="Wrap Field" parent="GtkSpinButton"
- icon-name="widget-gtk-spinbutton"/>
<glade-widget-class title="Relative Numeric Field" name="svxlo-SvxRelativeField"
generic-name="Relative Numeric Field" parent="GtkSpinButton"
icon-name="widget-gtk-spinbutton"/>
diff --git a/include/svx/wrapfield.hxx b/include/svx/wrapfield.hxx
deleted file mode 100644
index ff7cf3a..0000000
--- a/include/svx/wrapfield.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SVX_WRAPFIELD_HXX
-#define INCLUDED_SVX_WRAPFIELD_HXX
-
-#include <vcl/field.hxx>
-#include <svx/svxdllapi.h>
-
-namespace svx {
-
-
-
-/** A numeric spin field that wraps around the value on limits.
- @descr Note: Use type "NumericField" in resources. */
-class SVX_DLLPUBLIC WrapField : public NumericField
-{
-public:
- explicit WrapField( vcl::Window* pParent, WinBits nBits );
-
-protected:
- /** Up event with wrap-around functionality. */
- virtual void Up() SAL_OVERRIDE;
- /** Down event with wrap-around functionality. */
- virtual void Down() SAL_OVERRIDE;
-};
-
-
-
-} // namespace svx
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index ccea64f..f5e5ded 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -150,7 +150,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/dialog/swframeposstrings \
svx/source/dialog/txencbox \
svx/source/dialog/txenctab \
- svx/source/dialog/wrapfield \
svx/source/engine3d/float3d \
svx/source/items/algitem \
svx/source/items/hlnkitem \
diff --git a/svx/source/dialog/wrapfield.cxx b/svx/source/dialog/wrapfield.cxx
deleted file mode 100644
index c33ca31..0000000
--- a/svx/source/dialog/wrapfield.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "svx/wrapfield.hxx"
-#include <vcl/builder.hxx>
-
-namespace svx {
-
-WrapField::WrapField( vcl::Window* pParent, WinBits nBits ) :
- NumericField( pParent, nBits )
-{
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeWrapField(vcl::Window *pParent, VclBuilder::stringmap &)
-{
- return new WrapField(pParent, WB_SPIN|WB_REPEAT|WB_BORDER|WB_TABSTOP);
-}
-
-void WrapField::Up()
-{
- SetValue( ((GetValue() + GetSpinSize() - GetMin()) % (GetMax() + 1)) + GetMin() );
- GetUpHdl().Call( this );
-}
-
-void WrapField::Down()
-{
- SetValue( ((GetValue() - GetSpinSize() + GetMax() + 1 - GetMin()) % (GetMax() + 1)) + GetMin() );
- GetDownHdl().Call( this );
-}
-
-
-
-} // namespace svx
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d61fc0b8946eba921d6b9c6d5fcd76fca83c85d7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 25 15:01:41 2014 +0100
Related: fdo#83010 implement wrapping on reaching NumericFormatter limits
Change-Id: Ia88671cb71a0bcf8cb55ae0d88625b0f28092615
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index 546b1c9..35648a8 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -154,6 +154,7 @@ protected:
sal_uInt16 mnDecimalDigits;
bool mbThousandSep;
bool mbShowTrailingZeros;
+ bool mbWrapOnLimits;
// the members below are used in all derivatives of NumericFormatter
// not in NumericFormatter itself.
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 6972381..c475bd2 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -447,6 +447,7 @@ void NumericFormatter::ImplInit()
mnType = FORMAT_NUMERIC;
mbThousandSep = true;
mbShowTrailingZeros = true;
+ mbWrapOnLimits = false;
// for fields
mnSpinSize = 1;
@@ -655,7 +656,7 @@ void NumericFormatter::FieldDown()
else
nValue = (nRemainder == 0) ? nValue - mnSpinSize : nValue - mnSpinSize - nRemainder;
- nValue = ClipAgainstMinMax(mnMin);
+ nValue = ClipAgainstMinMax(nValue);
ImplNewFieldValue( nValue );
}
@@ -706,9 +707,9 @@ void NumericFormatter::ImplNewFieldValue( sal_Int64 nNewValue )
sal_Int64 NumericFormatter::ClipAgainstMinMax(sal_Int64 nValue) const
{
if (nValue > mnMax)
- nValue = mnMax;
+ nValue = mbWrapOnLimits ? mnMin : mnMax;
else if (nValue < mnMin)
- nValue = mnMin;
+ nValue = mbWrapOnLimits ? mnMax : mnMin;
return nValue;
}
@@ -739,6 +740,8 @@ bool NumericField::set_property(const OString &rKey, const OString &rValue)
SetDecimalDigits(rValue.toInt32());
else if (rKey == "spin-size")
SetSpinSize(rValue.toInt32());
+ else if (rKey == "wrap")
+ mbWrapOnLimits = toBool(rValue);
else
return SpinField::set_property(rKey, rValue);
return true;
commit e1a5ae3975dfa42003772f8afd98dde387d82653
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 25 14:47:20 2014 +0100
Related: fdo#83010 move NumericFormatter clipping to min/max into one place
Change-Id: I60cfe651a6ec25fc7e482192d908acca25c1ad8b
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index 1bf15e1..546b1c9 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -184,6 +184,8 @@ public:
void SetMax( sal_Int64 nNewMax );
sal_Int64 GetMax() const { return mnMax; }
+ sal_Int64 ClipAgainstMinMax(sal_Int64 nValue) const;
+
void SetFirst( sal_Int64 nNewFirst ) { mnFirst = nNewFirst; }
sal_Int64 GetFirst() const { return mnFirst; }
void SetLast( sal_Int64 nNewLast ) { mnLast = nNewLast; }
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index e57c7f6..6972381 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -417,11 +417,7 @@ bool NumericFormatter::ImplNumericReformat( const OUString& rStr, sal_Int64& rVa
return true;
else
{
- sal_Int64 nTempVal = rValue;
- if ( nTempVal > mnMax )
- nTempVal = mnMax;
- else if ( nTempVal < mnMin )
- nTempVal = mnMin;
+ sal_Int64 nTempVal = ClipAgainstMinMax(rValue);
if ( GetErrorHdl().IsSet() && (rValue != nTempVal) )
{
@@ -487,11 +483,7 @@ void NumericFormatter::ImplLoadRes( const ResId& rResId )
if ( NUMERICFORMATTER_VALUE & nMask )
{
- mnFieldValue = pMgr->ReadLong();
- if ( mnFieldValue > mnMax )
- mnFieldValue = mnMax;
- else if ( mnFieldValue < mnMin )
- mnFieldValue = mnMin;
+ mnFieldValue = ClipAgainstMinMax(pMgr->ReadLong());
mnLastValue = mnFieldValue;
}
@@ -554,10 +546,7 @@ OUString NumericFormatter::CreateFieldText( sal_Int64 nValue ) const
void NumericFormatter::ImplSetUserValue( sal_Int64 nNewValue, Selection* pNewSelection )
{
- if ( nNewValue > mnMax )
- nNewValue = mnMax;
- else if ( nNewValue < mnMin )
- nNewValue = mnMin;
+ nNewValue = ClipAgainstMinMax(nNewValue);
mnLastValue = nNewValue;
if ( GetField() )
@@ -579,11 +568,7 @@ sal_Int64 NumericFormatter::GetValue() const
if ( ImplNumericGetValue( GetField()->GetText(), nTempValue,
GetDecimalDigits(), ImplGetLocaleDataWrapper() ) )
{
- if ( nTempValue > mnMax )
- nTempValue = mnMax;
- else if ( nTempValue < mnMin )
- nTempValue = mnMin;
- return nTempValue;
+ return ClipAgainstMinMax(nTempValue);
}
else
return mnLastValue;
@@ -656,8 +641,7 @@ void NumericFormatter::FieldUp()
else
nValue = (nRemainder == 0) ? nValue + mnSpinSize : nValue - nRemainder;
- if ( nValue > mnMax )
- nValue = mnMax;
+ nValue = ClipAgainstMinMax(nValue);
ImplNewFieldValue( nValue );
}
@@ -671,8 +655,7 @@ void NumericFormatter::FieldDown()
else
nValue = (nRemainder == 0) ? nValue - mnSpinSize : nValue - mnSpinSize - nRemainder;
- if ( nValue < mnMin )
- nValue = mnMin;
+ nValue = ClipAgainstMinMax(mnMin);
ImplNewFieldValue( nValue );
}
@@ -720,6 +703,15 @@ void NumericFormatter::ImplNewFieldValue( sal_Int64 nNewValue )
}
}
+sal_Int64 NumericFormatter::ClipAgainstMinMax(sal_Int64 nValue) const
+{
+ if (nValue > mnMax)
+ nValue = mnMax;
+ else if (nValue < mnMin)
+ nValue = mnMin;
+ return nValue;
+}
+
NumericField::NumericField( vcl::Window* pParent, WinBits nWinStyle ) :
SpinField( pParent, nWinStyle )
{
@@ -1944,11 +1936,7 @@ sal_Int64 CurrencyFormatter::GetValue() const
sal_Int64 nTempValue;
if ( ImplCurrencyGetValue( GetField()->GetText(), nTempValue, GetDecimalDigits(), ImplGetLocaleDataWrapper() ) )
{
- if ( nTempValue > mnMax )
- nTempValue = mnMax;
- else if ( nTempValue < mnMin )
- nTempValue = mnMin;
- return nTempValue;
+ return ClipAgainstMinMax(nTempValue);
}
else
return mnLastValue;
commit 259ab763f236778b1c9c4a9707c0b9e0b565c24f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 25 11:23:52 2014 +0100
coverity#1240250 Buffer not null terminated
doesn't matter in practice
Change-Id: I410022a395d25827217b9c542d79718f6f5b333d
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index efab97e..8a3454e 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -202,12 +202,13 @@ void ImplWriteFillColor( SvStream& rOStm, const Color& rColor, sal_Int16 nStyle
void ImplWriteFont( SvStream& rOStm, const vcl::Font& rFont,
rtl_TextEncoding& rActualCharSet )
{
- char aName[32];
+ char aName[33];
short nWeight;
OString aByteName(OUStringToOString(rFont.GetName(),
rOStm.GetStreamCharSet()));
strncpy( aName, aByteName.getStr(), 32 );
+ aName[32] = 0;
switch ( rFont.GetWeight() )
{
commit 53644ab43236f19fbba5e61e499e0c4d3b9e7f1f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 25 11:18:39 2014 +0100
coverity#1147661 Uninitialized scalar value
Change-Id: I7a225287c9ca2f14d2e8da15380c541148d1a15f
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 8809231..21e16d3 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -121,6 +121,8 @@ Menu::Menu()
nMenuFlags(0),
nDefaultItem(0),
nSelectedId(0),
+ nImgOrChkPos(0),
+ nTextPos(0),
bCanceled(false),
bInCallback(false),
bKilled(false),
More information about the Libreoffice-commits
mailing list