[Libreoffice-commits] core.git: 3 commits - sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Jan 29 02:51:03 PST 2014


 sw/inc/fmtfsize.hxx               |    3 +++
 sw/inc/unomid.h                   |    1 +
 sw/inc/unoprnms.hxx               |    1 +
 sw/source/core/layout/atrfrm.cxx  |   16 ++++++++++++++--
 sw/source/core/layout/fly.cxx     |    9 +++++++--
 sw/source/core/unocore/unomap.cxx |    2 ++
 6 files changed, 28 insertions(+), 4 deletions(-)

New commits:
commit 7c7fdf3e97bbf2301f9938082d4d44162f4ec3c0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jan 29 11:43:43 2014 +0100

    swpagerelsize: take care of GetHeightPercentRelation() in SwFlyFrm::CalcRel
    
    Layout part, height.
    
    Change-Id: Iee239e1a39dd495ee965ac45325a0f7087fdcdfa

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 8f42605..1aa75a5 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2487,7 +2487,8 @@ Size SwFlyFrm::CalcRel( const SwFmtFrmSize &rSz ) const
         // When size is a relative to page size, ignore size of SwBodyFrm.
         if (rSz.GetWidthPercentRelation() != text::RelOrientation::PAGE_FRAME)
             nRelWidth  = std::min( nRelWidth,  pRel->Prt().Width() );
-        nRelHeight = std::min( nRelHeight, pRel->Prt().Height() );
+        if (rSz.GetHeightPercentRelation() != text::RelOrientation::PAGE_FRAME)
+            nRelHeight = std::min( nRelHeight, pRel->Prt().Height() );
         if( !pRel->IsPageFrm() )
         {
             const SwPageFrm* pPage = FindPageFrm();
@@ -2498,7 +2499,11 @@ Size SwFlyFrm::CalcRel( const SwFmtFrmSize &rSz ) const
                     nRelWidth  = std::min( nRelWidth,  pPage->Frm().Width() );
                 else
                     nRelWidth  = std::min( nRelWidth,  pPage->Prt().Width() );
-                nRelHeight = std::min( nRelHeight, pPage->Prt().Height() );
+                if (rSz.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME)
+                    // Ignore margins of pPage.
+                    nRelHeight = std::min( nRelHeight, pPage->Frm().Height() );
+                else
+                    nRelHeight = std::min( nRelHeight, pPage->Prt().Height() );
             }
         }
 
commit 9941687ff16d3a4b393563006ca4bdee5409fdbb
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jan 29 11:18:15 2014 +0100

    swpagerelsize: implement RelativeHeightRelation UNO property for SwXFrame
    
    UNO API, height.
    
    Change-Id: Ie61fb7f6de42b9dfb8b8f6f0982239d1c30f84ab

diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index d0db5b0..369d3d3 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -211,6 +211,7 @@
 #define UNO_NAME_RELATIVE_WIDTH "RelativeWidth"
 #define UNO_NAME_RELATIVE_WIDTH_RELATION "RelativeWidthRelation"
 #define UNO_NAME_RELATIVE_HEIGHT "RelativeHeight"
+#define UNO_NAME_RELATIVE_HEIGHT_RELATION "RelativeHeightRelation"
 #define UNO_NAME_REPEAT_HEADLINE "RepeatHeadline"
 #define UNO_NAME_SEARCH_STYLES "SearchStyles"
 #define UNO_NAME_SEARCH_BACKWARDS "SearchBackwards"
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 0f69154..a8b15f5 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -371,6 +371,7 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
     { OUString(UNO_NAME_POSITION_PROTECTED), RES_PROTECT,           cppu::UnoType<bool>::get(),             PROPERTY_NONE, MID_PROTECT_POSITION},                      \
     { OUString(UNO_NAME_PRINT), RES_PRINT,              cppu::UnoType<bool>::get(),         PROPERTY_NONE, 0},                                        \
     { OUString(UNO_NAME_RELATIVE_HEIGHT), RES_FRM_SIZE,         cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE,   MID_FRMSIZE_REL_HEIGHT },            \
+    { OUString(UNO_NAME_RELATIVE_HEIGHT_RELATION), RES_FRM_SIZE, cppu::UnoType<sal_Int16>::get()  ,        PROPERTY_NONE,   MID_FRMSIZE_REL_HEIGHT_RELATION  },         \
     { OUString(UNO_NAME_RELATIVE_WIDTH), RES_FRM_SIZE,          cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE,   MID_FRMSIZE_REL_WIDTH  },         \
     { OUString(UNO_NAME_RELATIVE_WIDTH_RELATION), RES_FRM_SIZE, cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE,   MID_FRMSIZE_REL_WIDTH_RELATION  },         \
     { OUString(UNO_NAME_SHADOW_FORMAT), RES_SHADOW,             cppu::UnoType<css::table::ShadowFormat>::get(),   PROPERTY_NONE, CONVERT_TWIPS},             \
@@ -828,6 +829,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                     { OUString(UNO_NAME_WIDTH), RES_FRM_SIZE,           cppu::UnoType<sal_Int32>::get()  ,         PROPERTY_NONE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS          },
                     { OUString(UNO_NAME_HEIGHT), RES_FRM_SIZE,          cppu::UnoType<sal_Int32>::get()  ,         PROPERTY_NONE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS         },
                     { OUString(UNO_NAME_RELATIVE_HEIGHT), RES_FRM_SIZE,         cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE,   MID_FRMSIZE_REL_HEIGHT },
+                    { OUString(UNO_NAME_RELATIVE_HEIGHT_RELATION), RES_FRM_SIZE, cppu::UnoType<sal_Int16>::get(),          PROPERTY_NONE,   MID_FRMSIZE_REL_HEIGHT_RELATION  },
                     { OUString(UNO_NAME_RELATIVE_WIDTH), RES_FRM_SIZE,          cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE,   MID_FRMSIZE_REL_WIDTH  },
                     { OUString(UNO_NAME_RELATIVE_WIDTH_RELATION), RES_FRM_SIZE,          cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE,   MID_FRMSIZE_REL_WIDTH_RELATION  },
                     { OUString(UNO_NAME_SIZE_TYPE), RES_FRM_SIZE,           cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE,   MID_FRMSIZE_SIZE_TYPE  },
commit 6dc71a690a8282d028419a662b5bb72ac97a951b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jan 29 10:55:42 2014 +0100

    swpagerelsize: add an eHeightPercentRelation member to SwFmtFrmSize
    
    This is the doc model part, height.
    
    Change-Id: I99eb4cadc2bd5f2025bc1b8793d4eede5b106d72

diff --git a/sw/inc/fmtfsize.hxx b/sw/inc/fmtfsize.hxx
index 2b1622e..d9af054 100644
--- a/sw/inc/fmtfsize.hxx
+++ b/sw/inc/fmtfsize.hxx
@@ -46,6 +46,7 @@ class SW_DLLPUBLIC SwFmtFrmSize: public SfxPoolItem
     sal_uInt8     nWidthPercent;
     sal_Int16     eWidthPercentRelation;
     sal_uInt8     nHeightPercent;
+    sal_Int16     eHeightPercentRelation;
 
     // For tables: width can be given in percent.
 
@@ -91,9 +92,11 @@ public:
     void    SetWidth ( const SwTwips nNew ) { aSize.Width()  = nNew; }
 
     sal_uInt8    GetHeightPercent() const{ return nHeightPercent; }
+    sal_Int16   GetHeightPercentRelation() const { return eHeightPercentRelation;  }
     sal_uInt8   GetWidthPercent() const { return nWidthPercent;  }
     sal_Int16   GetWidthPercentRelation() const { return eWidthPercentRelation;  }
     void    SetHeightPercent( sal_uInt8 n ) { nHeightPercent = n; }
+    void    SetHeightPercentRelation ( sal_Int16 n ) { eHeightPercentRelation  = n; }
     void    SetWidthPercent ( sal_uInt8 n ) { nWidthPercent  = n; }
     void    SetWidthPercentRelation ( sal_Int16 n ) { eWidthPercentRelation  = n; }
 };
diff --git a/sw/inc/unomid.h b/sw/inc/unomid.h
index 56956fb..11d14c9 100644
--- a/sw/inc/unomid.h
+++ b/sw/inc/unomid.h
@@ -85,6 +85,7 @@
 #define MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH     13
 #define MID_FRMSIZE_WIDTH_TYPE                  14
 #define MID_FRMSIZE_REL_WIDTH_RELATION          15
+#define MID_FRMSIZE_REL_HEIGHT_RELATION         16
 
 #define MID_COLUMNS                             0
 #define MID_COLUMN_SEPARATOR_LINE               1
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 038a4a1..e8cbaad 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -176,7 +176,7 @@ SwFmtFrmSize::SwFmtFrmSize( SwFrmSize eSize, SwTwips nWidth, SwTwips nHeight )
     eFrmHeightType( eSize ),
     eFrmWidthType( ATT_FIX_SIZE )
 {
-    nWidthPercent = eWidthPercentRelation = nHeightPercent = 0;
+    nWidthPercent = eWidthPercentRelation = nHeightPercent = eHeightPercentRelation = 0;
 }
 
 SwFmtFrmSize& SwFmtFrmSize::operator=( const SwFmtFrmSize& rCpy )
@@ -185,6 +185,7 @@ SwFmtFrmSize& SwFmtFrmSize::operator=( const SwFmtFrmSize& rCpy )
     eFrmHeightType = rCpy.GetHeightSizeType();
     eFrmWidthType = rCpy.GetWidthSizeType();
     nHeightPercent = rCpy.GetHeightPercent();
+    eHeightPercentRelation  = rCpy.GetHeightPercentRelation();
     nWidthPercent  = rCpy.GetWidthPercent();
     eWidthPercentRelation  = rCpy.GetWidthPercentRelation();
     return *this;
@@ -198,7 +199,8 @@ bool SwFmtFrmSize::operator==( const SfxPoolItem& rAttr ) const
             aSize           == ((SwFmtFrmSize&)rAttr).GetSize()&&
             nWidthPercent   == ((SwFmtFrmSize&)rAttr).GetWidthPercent() &&
             eWidthPercentRelation == ((SwFmtFrmSize&)rAttr).GetWidthPercentRelation() &&
-            nHeightPercent  == ((SwFmtFrmSize&)rAttr).GetHeightPercent() );
+            nHeightPercent  == ((SwFmtFrmSize&)rAttr).GetHeightPercent() &&
+            eHeightPercentRelation == ((SwFmtFrmSize&)rAttr).GetHeightPercentRelation() );
 }
 
 SfxPoolItem*  SwFmtFrmSize::Clone( SfxItemPool* ) const
@@ -223,6 +225,9 @@ bool SwFmtFrmSize::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
         case MID_FRMSIZE_REL_HEIGHT:
             rVal <<= (sal_Int16)(GetHeightPercent() != 0xFF ? GetHeightPercent() : 0);
         break;
+        case MID_FRMSIZE_REL_HEIGHT_RELATION:
+            rVal <<= GetHeightPercentRelation();
+        break;
         case MID_FRMSIZE_REL_WIDTH:
             rVal <<= (sal_Int16)(GetWidthPercent() != 0xFF ? GetWidthPercent() : 0);
         break;
@@ -304,6 +309,13 @@ bool SwFmtFrmSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                 bRet = false;
         }
         break;
+        case MID_FRMSIZE_REL_HEIGHT_RELATION:
+        {
+            sal_Int16 eSet = 0;
+            rVal >>= eSet;
+            SetHeightPercentRelation(eSet);
+        }
+        break;
         case MID_FRMSIZE_REL_WIDTH:
         {
             sal_Int16 nSet = 0;


More information about the Libreoffice-commits mailing list