[Libreoffice-commits] core.git: 4 commits - offapi/com sw/source

Zolnai Tamás tamas.zolnai at collabora.com
Thu Mar 6 11:14:29 PST 2014


 offapi/com/sun/star/text/BaseFrameProperties.idl |    7 -------
 offapi/com/sun/star/text/TextFrame.idl           |    6 ++++++
 sw/source/core/layout/calcmove.cxx               |   16 ++++++++--------
 sw/source/core/layout/fly.cxx                    |   14 ++++++++++++--
 sw/source/core/layout/flyincnt.cxx               |    8 +++++++-
 5 files changed, 33 insertions(+), 18 deletions(-)

New commits:
commit d9b4a8f5933fd4e7110717b0cdf5f3935203cc00
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Mar 6 20:00:17 2014 +0100

    Vertical content alignment of frames anchored as character
    
    Change-Id: Idf05edd102475675c8f0781af1f966043f342bb7

diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx
index ba7f5c5..0fa9b59 100644
--- a/sw/source/core/layout/flyincnt.cxx
+++ b/sw/source/core/layout/flyincnt.cxx
@@ -220,7 +220,7 @@ void SwFlyInCntFrm::MakeAll()
     if ( IsClipped() )
         mbValidSize = bHeightClipped = bWidthClipped = sal_False;
 
-    while ( !mbValidPos || !mbValidSize || !mbValidPrtArea )
+    while ( !mbValidPos || !mbValidSize || !mbValidPrtArea || !m_bValidContentPos )
     {
         //Only stop, if the flag is set!!
         if ( !mbValidSize )
@@ -229,7 +229,10 @@ void SwFlyInCntFrm::MakeAll()
         }
 
         if ( !mbValidPrtArea )
+        {
             MakePrtArea( rAttrs );
+            m_bValidContentPos = false;
+        }
 
         if ( !mbValidSize )
             Format( &rAttrs );
@@ -239,6 +242,9 @@ void SwFlyInCntFrm::MakeAll()
             MakeObjPos();
         }
 
+        if ( !m_bValidContentPos )
+            MakeContentPos( rAttrs );
+
         // re-activate clipping of as-character anchored Writer fly frames
         // depending on compatibility option <ClipAsCharacterAnchoredWriterFlyFrames>
         if ( mbValidPos && mbValidSize &&
commit 66882c88a26a1fb82f536f153b36e6a5049bda34
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Mar 6 20:02:17 2014 +0100

    Fix UNO API of vertical content alignment.
    
    This property can applied just for text frames, not others
    which can have base frame properties.
    
    Change-Id: I551a2e17bb42855d3e948c7fc672ec5e3a451c55

diff --git a/offapi/com/sun/star/text/BaseFrameProperties.idl b/offapi/com/sun/star/text/BaseFrameProperties.idl
index 2a1f25c..c441343 100644
--- a/offapi/com/sun/star/text/BaseFrameProperties.idl
+++ b/offapi/com/sun/star/text/BaseFrameProperties.idl
@@ -352,13 +352,6 @@ published service BaseFrameProperties
             @since LibreOffice 4.3
          */
         [optional, property] short RelativeWidthRelation;
-
-        /** adjusts the vertical position of the text inside of the frame.
-
-            @see com::sun::star::drawing::TextVerticalAdjust
-            @since LibreOffice 4.3
-         */
-        [optional, property] com::sun::star::drawing::TextVerticalAdjust TextVerticalAdjust;
 };
 
 
diff --git a/offapi/com/sun/star/text/TextFrame.idl b/offapi/com/sun/star/text/TextFrame.idl
index 676703d..68a7314 100644
--- a/offapi/com/sun/star/text/TextFrame.idl
+++ b/offapi/com/sun/star/text/TextFrame.idl
@@ -136,6 +136,12 @@ published service TextFrame
      */
     [optional, property] boolean IsFollowingTextFlow;
 
+    /** adjusts the vertical position of the text inside of the frame.
+
+        @see com::sun::star::drawing::TextVerticalAdjust
+        @since LibreOffice 4.3
+    */
+    [optional, property] com::sun::star::drawing::TextVerticalAdjust TextVerticalAdjust;
 };
 
 
commit 41ad6531c75a53262933aecb0685f5c876de7251
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Mar 6 14:59:31 2014 +0100

    Vertical content alignment of vertical text frames
    
    Change-Id: If365684f8fec5c560e948e3428681462e227dc00

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 38db766..48ab36b 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1711,11 +1711,21 @@ void SwFlyFrm::MakeContentPos( const SwBorderAttrs &rAttrs )
             {
                 if( nAdjust == SDRTEXTVERTADJUST_CENTER )
                 {
-                    aNewContentPos.setY(aNewContentPos.getY() + nDiff/2);
+                    if( bVertL2R )
+                        aNewContentPos.setX(aNewContentPos.getX() + nDiff/2);
+                    else if( bVert )
+                        aNewContentPos.setX(aNewContentPos.getX() - nDiff/2);
+                    else
+                        aNewContentPos.setY(aNewContentPos.getY() + nDiff/2);
                 }
                 else if( nAdjust == SDRTEXTVERTADJUST_BOTTOM )
                 {
-                    aNewContentPos.setY(aNewContentPos.getY() + nDiff);
+                    if( bVertL2R )
+                        aNewContentPos.setX(aNewContentPos.getX() + nDiff);
+                    else if( bVert )
+                        aNewContentPos.setX(aNewContentPos.getX() - nDiff);
+                    else
+                        aNewContentPos.setY(aNewContentPos.getY() + nDiff);
                 }
             }
         }
commit 8b4fcb9c048d8189693a866c89bc257021352b86
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Mar 6 13:34:09 2014 +0100

    Avoid infinite loop caused by vertical content alignment
    
    In some case invalidations makes the program to go
    into an infinite loop.
    Move InvalidateContentPos() call upper in the
    SwCntntFrm::MakeAll method so it won't be called
    when size invalidation is made inside this
    method.
    
    Change-Id: I25deccb1760b82a764cad3e90aafb092631a1533

diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 88be7b6..da97bcf 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1266,6 +1266,14 @@ void SwCntntFrm::MakeAll()
             }
 
             (Frm().*fnRect->fnSetWidth)( nNewFrmWidth );
+
+            // When a lower of a vertically aligned fly frame changes it's size we need to recalculate content pos.
+            if( GetUpper() && GetUpper()->IsFlyFrm() &&
+                GetUpper()->GetFmt()->GetTextVertAdjust().GetValue() != SDRTEXTVERTADJUST_TOP )
+            {
+                static_cast<SwFlyFrm*>(GetUpper())->InvalidateContentPos();
+                GetUpper()->SetCompletePaint();
+            }
         }
         if ( !mbValidPrtArea )
         {
@@ -1340,14 +1348,6 @@ void SwCntntFrm::MakeAll()
             if ( nConsequetiveFormatsWithoutChange <= cnStopFormat )
             {
                 Format();
-
-                // When a lower of a vertically aligned fly frame changes it's size we need to recalculate content pos.
-                if( GetUpper() && GetUpper()->IsFlyFrm() &&
-                    GetUpper()->GetFmt()->GetTextVertAdjust().GetValue() != SDRTEXTVERTADJUST_TOP )
-                {
-                    static_cast<SwFlyFrm*>(GetUpper())->InvalidateContentPos();
-                    GetUpper()->SetCompletePaint();
-                }
             }
 #if OSL_DEBUG_LEVEL > 0
             else


More information about the Libreoffice-commits mailing list