[Libreoffice-commits] .: 2 commits - sw/source sw/uiconfig vcl/inc vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 26 04:12:48 PDT 2012


 sw/source/filter/ww1/fltshell.cxx     |    6 +++--
 sw/source/ui/cctrl/actctrl.cxx        |    2 -
 sw/uiconfig/swriter/ui/charurlpage.ui |    3 ++
 vcl/inc/vcl/edit.hxx                  |    6 ++---
 vcl/source/control/combobox.cxx       |    6 ++---
 vcl/source/control/edit.cxx           |   40 ++++++++++++++++++++++------------
 6 files changed, 41 insertions(+), 22 deletions(-)

New commits:
commit 08ffb7bc5ec4472126762f4cb9677349b61122f6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 26 11:47:13 2012 +0100

    Resolves: fdo#50285 merging props unsafe with intermediate charstyle prop
    
    Its a nice idea to merge properties of the same type and value if one starts
    and the same place the last one ended. But character styles are properties as
    well, so if we have character-style+superscript on range a, and
    character-style+superscript on range b and merge these so that we end up as...
    
    character-style on range a, superscript on range a+b, and character-style on
    range b then that clearly gives the wrong result if applied in that order.
    
    So its only safe to merge if there are no intermediate properties that can
    affect the merge candidates.
    
    A regression from b3cee382f449aa69213dc21f7b1ba6a5356d2865
    
    Change-Id: I541563d11265426736b840de068922eef8d45573

diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index 2693097..5e23c02 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -325,6 +325,8 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
     myEIter aI = maEntries.begin();
     while (aI != maEntries.end())
     {
+        bool bLastEntry = aI == maEntries.end() - 1;
+
         SwFltStackEntry& rEntry = *aI;
         if (rEntry.bOpen)
         {
@@ -350,7 +352,7 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
             {
                 rEntry.bConsumedByField = consumedByField;
                 rEntry.SetEndPos(rPos);
-                if (nAttrId == rEntry.pAttr->Which())
+                if (bLastEntry && nAttrId == rEntry.pAttr->Which())
                 {
                     //potential candidate for merging with an identical
                     //property beginning at rPos
@@ -377,7 +379,7 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
             //we advance to the next node, or finish processing the document
             if (rEntry.m_aPtPos.m_nNode.GetIndex() == aFltPos.m_nNode.GetIndex())
             {
-                if (nAttrId == rEntry.pAttr->Which() &&
+                if (bLastEntry && nAttrId == rEntry.pAttr->Which() &&
                     rEntry.m_aPtPos.m_nCntnt == aFltPos.m_nCntnt)
                 {
                     //potential candidate for merging with an identical
commit 55619c1028b31f55c5b205ce3615bd606f5414f0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 26 09:15:43 2012 +0100

    set width in chars for url field to avoid character dialog overgrowing
    
    Change-Id: I892a77f65ad420d0fbf4b95179e4bcfc2ec55192

diff --git a/sw/source/ui/cctrl/actctrl.cxx b/sw/source/ui/cctrl/actctrl.cxx
index 6300fee..7844f06 100644
--- a/sw/source/ui/cctrl/actctrl.cxx
+++ b/sw/source/ui/cctrl/actctrl.cxx
@@ -129,7 +129,7 @@ void ReturnActionEdit::KeyInput( const KeyEvent& rEvt)
 extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeTableNameEdit(Window *pParent, VclBuilder::stringmap &)
 {
     TableNameEdit* pTableNameEdit = new TableNameEdit(pParent);
-    pTableNameEdit->SetMinWidthInChars(25);
+    pTableNameEdit->SetWidthInChars(25);
     return pTableNameEdit;
 }
 
diff --git a/sw/uiconfig/swriter/ui/charurlpage.ui b/sw/uiconfig/swriter/ui/charurlpage.ui
index a12265f..a39e0e2 100644
--- a/sw/uiconfig/swriter/ui/charurlpage.ui
+++ b/sw/uiconfig/swriter/ui/charurlpage.ui
@@ -101,6 +101,7 @@
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
                     <property name="invisible_char">●</property>
+                    <property name="width_chars">32</property>
                     <property name="invisible_char_set">True</property>
                   </object>
                   <packing>
@@ -115,6 +116,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="invisible_char">●</property>
+                    <property name="width_chars">32</property>
                     <property name="invisible_char_set">True</property>
                   </object>
                   <packing>
@@ -129,6 +131,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="invisible_char">●</property>
+                    <property name="width_chars">32</property>
                     <property name="invisible_char_set">True</property>
                   </object>
                   <packing>
diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx
index 5cb189c..bcd0463 100644
--- a/vcl/inc/vcl/edit.hxx
+++ b/vcl/inc/vcl/edit.hxx
@@ -78,7 +78,7 @@ private:
     Selection           maSelection;
     sal_uInt16          mnAlign;
     xub_StrLen          mnMaxTextLen;
-    sal_Int32           mnMinWidthInChars;
+    sal_Int32           mnWidthInChars;
     AutocompleteAction  meAutocompleteAction;
     sal_Unicode         mcEchoChar;
     sal_Bool                mbModified:1,
@@ -199,8 +199,8 @@ public:
     virtual void        SetMaxTextLen( xub_StrLen nMaxLen = EDIT_NOLIMIT );
     virtual xub_StrLen  GetMaxTextLen() const { return mnMaxTextLen; }
 
-    void                SetMinWidthInChars(sal_Int32 nMinWidthInChars);
-    sal_Int32           GetMinWidthInChars() const { return mnMinWidthInChars; }
+    void                SetWidthInChars(sal_Int32 nWidthInChars);
+    sal_Int32           GetWidthInChars() const { return mnWidthInChars; }
 
     virtual void        SetSelection( const Selection& rSelection );
     virtual const Selection&    GetSelection() const;
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 6dae223..49558e2 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -61,7 +61,7 @@ ComboBox::ComboBox( WindowType nType ) :
     Edit( nType )
 {
     ImplInitComboBoxData();
-    SetMinWidthInChars(0);
+    SetWidthInChars(-1);
 }
 
 // -----------------------------------------------------------------------
@@ -71,7 +71,7 @@ ComboBox::ComboBox( Window* pParent, WinBits nStyle ) :
 {
     ImplInitComboBoxData();
     ImplInit( pParent, nStyle );
-    SetMinWidthInChars(0);
+    SetWidthInChars(-1);
 }
 
 // -----------------------------------------------------------------------
@@ -85,7 +85,7 @@ ComboBox::ComboBox( Window* pParent, const ResId& rResId ) :
     ImplInit( pParent, nStyle );
     ImplLoadRes( rResId );
 
-    SetMinWidthInChars(0);
+    SetWidthInChars(-1);
     if ( !(nStyle & WB_HIDE ) )
         Show();
 }
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index d3be1ba..f5a5f41 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -219,11 +219,11 @@ Edit::Edit( Window* pParent, const ResId& rResId ) :
         Show();
 }
 
-void Edit::SetMinWidthInChars(sal_Int32 nMinWidthInChars)
+void Edit::SetWidthInChars(sal_Int32 nWidthInChars)
 {
-    if (mnMinWidthInChars != nMinWidthInChars)
+    if (mnWidthInChars != nWidthInChars)
     {
-        mnMinWidthInChars = nMinWidthInChars;
+        mnWidthInChars = nWidthInChars;
         queue_resize();
     }
 }
@@ -231,7 +231,12 @@ void Edit::SetMinWidthInChars(sal_Int32 nMinWidthInChars)
 bool Edit::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
 {
     if (rKey == "width-chars")
-        SetMinWidthInChars(rValue.toInt32());
+        SetWidthInChars(rValue.toInt32());
+    else if (rKey == "max-length")
+    {
+        sal_Int32 nTextLen = rValue.toInt32();
+        SetMaxTextLen(nTextLen == 0 ? EDIT_NOLIMIT : nTextLen);
+    }
     else if (rKey == "editable")
         SetReadOnly(!toBool(rValue));
     else if (rKey == "visibility")
@@ -266,7 +271,7 @@ void Edit::take_properties(Window &rOther)
     maSelection = rOtherEdit.maSelection;
     mnAlign = rOtherEdit.mnAlign;
     mnMaxTextLen = rOtherEdit.mnMaxTextLen;
-    mnMinWidthInChars = rOtherEdit.mnMinWidthInChars;
+    mnWidthInChars = rOtherEdit.mnWidthInChars;
     meAutocompleteAction = rOtherEdit.meAutocompleteAction;
     mcEchoChar = rOtherEdit.mcEchoChar;
     mbModified = rOtherEdit.mbModified;
@@ -341,7 +346,7 @@ void Edit::ImplInitEditData()
     mnXOffset               = 0;
     mnAlign                 = EDIT_ALIGN_LEFT;
     mnMaxTextLen            = EDIT_NOLIMIT;
-    mnMinWidthInChars       = 3;
+    mnWidthInChars          = -1;
     meAutocompleteAction    = AUTOCOMPLETE_KEYINPUT;
     mbModified              = sal_False;
     mbInternModified        = sal_False;
@@ -2890,13 +2895,22 @@ void Edit::SetSubEdit( Edit* pEdit )
 
 Size Edit::CalcMinimumSizeForText(const rtl::OUString &rString) const
 {
-    Size aSize ( GetTextWidth( rString ), GetTextHeight() );
-    aSize.Width() += ImplGetExtraOffset() * 2;
-    // do not create edit fields in which one cannot enter anything
-    // a default minimum width should exist for at least 3 characters
-    Size aMinSize ( CalcSize( mnMinWidthInChars ) );
-    if( aSize.Width() < aMinSize.Width() )
-        aSize.Width() = aMinSize.Width();
+    Size aSize;
+    if (mnWidthInChars != -1)
+    {
+        aSize = CalcSize(mnWidthInChars);
+    }
+    else
+    {
+        aSize.Height() = GetTextHeight();
+        aSize.Width() = GetTextWidth(rString);
+        aSize.Width() += ImplGetExtraOffset() * 2;
+        // do not create edit fields in which one cannot enter anything
+        // a default minimum width should exist for at least 3 characters
+        Size aMinSize(CalcSize(3));
+        if (aSize.Width() < aMinSize.Width())
+            aSize.Width() = aMinSize.Width();
+    }
     // add some space between text entry and border
     aSize.Height() += 4;
 


More information about the Libreoffice-commits mailing list