[Libreoffice-commits] .: 6 commits - cui/source editeng/inc editeng/source offapi/com svx/sdi sw/inc sw/source writerfilter/source xmloff/inc xmloff/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Mar 12 10:42:32 PDT 2012


 cui/source/inc/paragrph.hxx                       |    2 +
 cui/source/tabpages/paragrph.cxx                  |   16 ++++++++-
 cui/source/tabpages/paragrph.hrc                  |    1 
 cui/source/tabpages/paragrph.src                  |   21 +++++++----
 editeng/inc/editeng/memberids.hrc                 |    1 
 editeng/inc/editeng/ulspitem.hxx                  |    4 ++
 editeng/source/items/frmitems.cxx                 |    8 ++++
 offapi/com/sun/star/style/ParagraphProperties.idl |    9 +++++
 svx/sdi/svxitems.sdi                              |    1 
 sw/inc/unoprnms.hxx                               |    4 +-
 sw/source/core/layout/flowfrm.cxx                 |   39 +++++++++++++++++++++-
 sw/source/core/unocore/unomap.cxx                 |    2 +
 sw/source/core/unocore/unoprnms.cxx               |    2 +
 sw/source/filter/ww8/docxattributeoutput.cxx      |    4 ++
 sw/source/ui/chrdlg/pardlg.cxx                    |    2 -
 writerfilter/source/dmapper/DomainMapper.cxx      |    2 -
 writerfilter/source/dmapper/PropertyIds.cxx       |    1 
 writerfilter/source/dmapper/PropertyIds.hxx       |    1 
 xmloff/inc/xmloff/xmltoken.hxx                    |    1 
 xmloff/source/core/xmltoken.cxx                   |    1 
 xmloff/source/text/txtprmap.cxx                   |    1 
 21 files changed, 111 insertions(+), 12 deletions(-)

New commits:
commit 9f4bb5bd4f55b4a80544413efde26391849b1d7f
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Mar 12 17:35:16 2012 +0100

    xmloff: implement contextual spacing import/export

diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 3a07e30..f241023 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -467,6 +467,7 @@ namespace xmloff { namespace token {
         XML_CONTENT_VALIDATION,
         XML_CONTENT_VALIDATION_NAME,
         XML_CONTENT_VALIDATIONS,
+        XML_CONTEXTUAL_SPACING,
         XML_CONTINUE,
         XML_CONTINUE_NUMBERING,
         XML_CONTOUR_PATH,
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 9ccc67f..7c56037 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -471,6 +471,7 @@ namespace xmloff { namespace token {
         TOKEN( "content-validation",              XML_CONTENT_VALIDATION ),
         TOKEN( "content-validation-name",         XML_CONTENT_VALIDATION_NAME ),
         TOKEN( "content-validations",             XML_CONTENT_VALIDATIONS ),
+        TOKEN( "contextual-spacing",              XML_CONTEXTUAL_SPACING ),
         TOKEN( "continue",                        XML_CONTINUE ),
         TOKEN( "continue-numbering",              XML_CONTINUE_NUMBERING ),
         TOKEN( "contour-path",                    XML_CONTOUR_PATH ),
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index ba5c899..c1ec7e0 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -101,6 +101,7 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
     MP_E( "ParaTopMarginRelative",  FO, MARGIN_TOP,         XML_TYPE_PERCENT16, CTF_PARATOPMARGIN_REL ),
     MP_E( "ParaBottomMargin",       FO, MARGIN_BOTTOM,      XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARABOTTOMMARGIN ),
     MP_E( "ParaBottomMarginRelative",FO,    MARGIN_BOTTOM,      XML_TYPE_PERCENT16, CTF_PARABOTTOMMARGIN_REL ),
+    { "ParaContextMargin", sizeof("ParaContextMargin")-1, XML_NAMESPACE_STYLE, XML_CONTEXTUAL_SPACING, XML_TYPE_BOOL|XML_TYPE_PROP_PARAGRAPH, 0, SvtSaveOptions::ODFVER_LATEST },
     // RES_CHRATR_CASEMAP
     MT_E( "CharCaseMap",        FO,     FONT_VARIANT,       XML_TYPE_TEXT_CASEMAP_VAR,  0 ),
     MT_E( "CharCaseMap",        FO,     TEXT_TRANSFORM,     XML_TYPE_TEXT_CASEMAP,  0 ),
commit 8631dbf85fb5ed56d225e32ea5a9c36c96b0d649
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Mar 9 15:48:53 2012 +0100

    cui: implement contextual spacing UI

diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 7a7af80..1267298 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -85,6 +85,7 @@ private:
     SvxRelativeField        aTopDist;
     FixedText               aBottomLabel;
     SvxRelativeField        aBottomDist;
+    CheckBox                aContextualCB;
 
     // Zeilenabstand
     FixedLine               aLineDistFrm;
@@ -132,6 +133,7 @@ public:
     void                    SetPageWidth( sal_uInt16 nPageWidth );
     void                    EnableRelativeMode();
     void                    EnableRegisterMode();
+    void                    EnableContextualMode();
     void                    EnableAutoFirstLine();
     void                    EnableAbsLineDist(long nMinTwip);
     void                    EnableNegativeMode();
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 5672b45..a2334b5 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -282,7 +282,8 @@ sal_Bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
         }
     }
 
-    if ( aTopDist.IsValueModified() || aBottomDist.IsValueModified() )
+    if ( aTopDist.IsValueModified() || aBottomDist.IsValueModified()
+            || aContextualCB.GetSavedValue() != aContextualCB.IsChecked())
     {
         nWhich = GetWhich( SID_ATTR_ULSPACE );
         SfxMapUnit eUnit = pPool->GetMetric( nWhich );
@@ -314,6 +315,7 @@ sal_Bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
             aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) );
             aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) );
         }
+        aMargin.SetContextValue(aContextualCB.IsChecked());
         eState = GetItemSet().GetItemState( nWhich );
 
         if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aMargin ) ||
@@ -574,6 +576,7 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet )
             SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit );
             SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit );
         }
+        aContextualCB.Check(rOldItem.GetContext());
     }
     else
     {
@@ -618,6 +621,7 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet )
 
     ELRLoseFocusHdl( NULL );
     aAutoCB.SaveValue();
+    aContextualCB.SaveValue();
     aLineDist.SaveValue();
 }
 
@@ -667,6 +671,7 @@ SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window* pParent,
     aTopDist                ( this, CUI_RES( ED_TOPDIST ) ),
     aBottomLabel            ( this, CUI_RES( FT_BOTTOMDIST ) ),
     aBottomDist             ( this, CUI_RES( ED_BOTTOMDIST ) ),
+    aContextualCB           ( this, CUI_RES( CB_CONTEXTUALSPACING ) ),
 
     aLineDistFrm            ( this, CUI_RES( FL_LINEDIST ) ),
     aLineDist               ( this, CUI_RES( LB_LINEDIST ) ),
@@ -959,6 +964,11 @@ void SvxStdParagraphTabPage::EnableRegisterMode()
     aRegisterFL.Show();
 }
 
+void SvxStdParagraphTabPage::EnableContextualMode()
+{
+    aContextualCB.Show();
+}
+
 IMPL_LINK( SvxStdParagraphTabPage, AutoHdl_Impl, CheckBox*, pBox )
 {
     sal_Bool bEnable = !pBox->IsChecked();
@@ -994,6 +1004,7 @@ void    SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet)
                         0x0002 --->EnableRegisterMode()
                         0x0004 --->EnableAutoFirstLine()
                         0x0008 --->EnableNegativeMode()
+                        0x0010 --->EnableContextualMode()
             */
     SFX_ITEMSET_ARG (&aSet,pPageWidthItem,SfxUInt16Item,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,sal_False);
     SFX_ITEMSET_ARG (&aSet,pFlagSetItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,sal_False);
@@ -1021,6 +1032,9 @@ void    SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet)
         if  (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
                 EnableNegativeMode();
 
+    if (pFlagSetItem)
+        if  (( 0x0010 & pFlagSetItem->GetValue()) == 0x0010 )
+                EnableContextualMode();
 }
 
 
diff --git a/cui/source/tabpages/paragrph.hrc b/cui/source/tabpages/paragrph.hrc
index c6158a2..bb9a3fc 100644
--- a/cui/source/tabpages/paragrph.hrc
+++ b/cui/source/tabpages/paragrph.hrc
@@ -42,6 +42,7 @@
 #define FT_BOTTOMDIST           22
 #define ED_BOTTOMDIST           23
 #define FL_DIST                         24
+#define CB_CONTEXTUALSPACING            25
 
 #define BTN_LEFTALIGN           30
 #define BTN_RIGHTALIGN          31
diff --git a/cui/source/tabpages/paragrph.src b/cui/source/tabpages/paragrph.src
index b5659ca..d6de18e 100644
--- a/cui/source/tabpages/paragrph.src
+++ b/cui/source/tabpages/paragrph.src
@@ -36,7 +36,7 @@ TabPage RID_SVXPAGE_STD_PARAGRAPH
     HelpId = HID_FORMAT_PARAGRAPH_STD ;
     Hide = TRUE ;
     Text [ en-US ] = "Indents and Spacing" ;
-    Size = MAP_APPFONT ( 260 , 185 ) ;
+    Size = MAP_APPFONT ( 260 , 199 ) ;
     FixedText FT_LEFTINDENT
     {
         Pos = MAP_APPFONT ( 12 , 16 ) ;
@@ -168,6 +168,13 @@ TabPage RID_SVXPAGE_STD_PARAGRAPH
         Last = 9999 ;
         SpinSize = 10 ;
     };
+    CheckBox CB_CONTEXTUALSPACING
+    {
+        Pos = MAP_APPFONT ( 12 , 118 ) ;
+        Size = MAP_APPFONT ( 173 , 10 ) ;
+        Hide = TRUE ;
+        Text [ en-US ] = "Don't add space between paragraphs of the same style" ;
+    };
     FixedLine FL_DIST
     {
         Pos = MAP_APPFONT ( 6 , 77 ) ;
@@ -177,7 +184,7 @@ TabPage RID_SVXPAGE_STD_PARAGRAPH
     ListBox LB_LINEDIST
     {
         HelpID = "cui:ListBox:RID_SVXPAGE_STD_PARAGRAPH:LB_LINEDIST";
-        Pos = MAP_APPFONT ( 12 , 133 ) ;
+        Pos = MAP_APPFONT ( 12 , 147 ) ;
         Size = MAP_APPFONT ( 55 , 72 ) ;
         DropDown = TRUE ;
         StringList [ en-US ] =
@@ -197,7 +204,7 @@ TabPage RID_SVXPAGE_STD_PARAGRAPH
     FixedText FT_LINEDIST
     {
         Disable = TRUE ;
-        Pos = MAP_APPFONT ( 70 , 135 ) ;
+        Pos = MAP_APPFONT ( 70 , 149 ) ;
         Size = MAP_APPFONT ( 60 , 8 ) ;
         Text [ en-US ] = "of" ;
         Left = TRUE ;
@@ -207,7 +214,7 @@ TabPage RID_SVXPAGE_STD_PARAGRAPH
         HelpID = "cui:MetricField:RID_SVXPAGE_STD_PARAGRAPH:ED_LINEDISTPERCENT";
         Disable = TRUE ;
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 135 , 133 ) ;
+        Pos = MAP_APPFONT ( 135 , 147 ) ;
         Size = MAP_APPFONT ( 40 , 12 ) ;
         Group = TRUE ;
         Left = TRUE ;
@@ -242,7 +249,7 @@ TabPage RID_SVXPAGE_STD_PARAGRAPH
     };
     FixedLine FL_LINEDIST
     {
-        Pos = MAP_APPFONT ( 6 , 122 ) ;
+        Pos = MAP_APPFONT ( 6 , 136 ) ;
         Size = MAP_APPFONT ( 173 , 8 ) ;
         Text [ en-US ] = "Line spacing" ;
     };
@@ -255,14 +262,14 @@ TabPage RID_SVXPAGE_STD_PARAGRAPH
     CheckBox CB_REGISTER
     {
         HelpID = "cui:CheckBox:RID_SVXPAGE_STD_PARAGRAPH:CB_REGISTER";
-        Pos = MAP_APPFONT ( 12 , 162 ) ;
+        Pos = MAP_APPFONT ( 12 , 176 ) ;
         Size = MAP_APPFONT ( 120 , 10 ) ;
         Hide = TRUE ;
         Text [ en-US ] = "A~ctivate" ;
     };
     FixedLine FL_REGISTER
     {
-        Pos = MAP_APPFONT ( 6 , 151 ) ;
+        Pos = MAP_APPFONT ( 6 , 165 ) ;
         Size = MAP_APPFONT ( 173 , 8 ) ;
         Hide = TRUE ;
         Text [ en-US ] = "Register-true" ;
diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx
index 50b6196..be65dfb 100644
--- a/sw/source/ui/chrdlg/pardlg.cxx
+++ b/sw/source/ui/chrdlg/pardlg.cxx
@@ -186,7 +186,7 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
 
         if (!bDrawParaDlg)
         {
-            aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000E));
+            aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x001E));
             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/10));
 
         }
commit 03f9b6bebc0ca77021be46664c7bcbe4cb297503
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Mar 9 14:21:07 2012 +0100

    DocxAttributeOutput: implement contextual spacing

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1b1de4f..77da6da 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4007,6 +4007,10 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
                 OString::valueOf( (sal_Int32)rULSpace.GetUpper() ) );
         m_pParagraphSpacingAttrList->add( FSNS( XML_w, XML_after ),
                 OString::valueOf( (sal_Int32)rULSpace.GetLower() ) );
+        if (rULSpace.GetContext())
+            m_pSerializer->singleElementNS( XML_w, XML_contextualSpacing, FSEND );
+        else
+            m_pSerializer->singleElementNS( XML_w, XML_contextualSpacing, FSNS( XML_w, XML_val ), "false", FSEND );
     }
 }
 
commit 11059331718fb8faab483c75633b4e80d8028b7d
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Mar 9 13:03:29 2012 +0100

    SwFlowFrm: implement contextual spacing

diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index b8e425d..fe1ed54 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1433,6 +1433,38 @@ const SwFrm* SwFlowFrm::_GetPrevFrmForUpperSpaceCalc( const SwFrm* _pProposedPre
     return pPrevFrm;
 }
 
+/// Compare styles attached to these text frames.
+bool lcl_IdenticalStyles(const SwFrm* pPrevFrm, const SwFrm* pFrm)
+{
+    SwTxtFmtColl *pPrevFmtColl = 0;
+    if (pPrevFrm && pPrevFrm->IsTxtFrm())
+    {
+        SwTxtFrm *pTxtFrm = ( SwTxtFrm * ) pPrevFrm;
+        pPrevFmtColl = dynamic_cast<SwTxtFmtColl*>(pTxtFrm->GetTxtNode()->GetFmtColl());
+    }
+
+    bool bIdenticalStyles = false;
+    if (pFrm && pFrm->IsTxtFrm())
+    {
+        SwTxtFrm *pTxtFrm = ( SwTxtFrm * ) pFrm;
+        SwTxtFmtColl *pFmtColl = dynamic_cast<SwTxtFmtColl*>(pTxtFrm->GetTxtNode()->GetFmtColl());
+        bIdenticalStyles = pPrevFmtColl == pFmtColl;
+    }
+    return bIdenticalStyles;
+}
+
+bool lcl_getContextualSpacing(const SwFrm* pPrevFrm)
+{
+    bool bRet;
+    SwBorderAttrAccess *pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), pPrevFrm );
+    const SwBorderAttrs *pAttrs = pAccess->Get();
+
+    bRet = pAttrs->GetULSpace().GetContext();
+
+    delete pAccess;
+    return bRet;
+}
+
 // OD 2004-03-12 #i11860# - add 3rd parameter <_bConsiderGrid>
 SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs,
                                    const SwFrm* pPr,
@@ -1591,8 +1623,13 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs,
         nUpper += _GetUpperSpaceAmountConsideredForPageGrid( nUpper );
     }
 
+    bool bContextualSpacing = pAttrs->GetULSpace().GetContext();
     delete pAccess;
-    return nUpper;
+
+    if (bContextualSpacing && lcl_getContextualSpacing(pPrevFrm) && lcl_IdenticalStyles(pPrevFrm, &rThis))
+        return 0;
+    else
+        return nUpper;
 }
 
 /** method to detemine the upper space amount, which is considered for
commit 0662778b0b4b9958ee5e5bd3bac69f9e290f9495
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Mar 8 21:20:12 2012 +0100

    dmapper: implement contextual spacing

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 54be384..a400b4b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3146,7 +3146,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
     case NS_ooxml::LN_EG_RPrBase_snapToGrid: // "Use document grid  settings for inter-paragraph spacing"
     break;
     case NS_sprm::LN_PContextualSpacing:
-        //TODO: determines whether top/bottom paragraph spacing is added if equal styles are following - unsupported
+        rContext->Insert(PROP_PARA_CONTEXT_MARGIN, true, uno::makeAny( sal_Bool( nIntValue ) ));
     break;
     case NS_ooxml::LN_EG_SectPrContents_formProt: //section protection, only form editing is enabled - unsupported
     case NS_ooxml::LN_EG_SectPrContents_vAlign:
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index c8f8a55..12958b4 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -123,6 +123,7 @@ const rtl::OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
             case PROP_PARA_FIRST_LINE_INDENT:    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent")); break;
             case PROP_PARA_KEEP_TOGETHER:       sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether")); break;
             case PROP_PARA_TOP_MARGIN:       sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin")); break;
+            case PROP_PARA_CONTEXT_MARGIN:       sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaContextMargin")); break;
             case PROP_PARA_BOTTOM_MARGIN:       sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin")); break;
             case PROP_PARA_IS_HYPHENATION:     sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")); break;
             case PROP_PARA_LINE_NUMBER_COUNT:     sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount")); break;
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index b109cd6..e440660 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -292,6 +292,7 @@ enum PropertyIds
         ,PROP_WRITING_MODE
 /*253*/ ,PROP_FRM_DIRECTION
         ,PROP_EMBEDDED_OBJECT
+        ,PROP_PARA_CONTEXT_MARGIN
     };
 struct PropertyNameSupplier_Impl;
 class PropertyNameSupplier
commit 6f04bf5e90ff75288dcf75c43843edf798641e3d
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Mar 8 18:50:59 2012 +0100

    SvxULSpaceItem: implement contextual spacing

diff --git a/editeng/inc/editeng/memberids.hrc b/editeng/inc/editeng/memberids.hrc
index b53276c..45e059f 100755
--- a/editeng/inc/editeng/memberids.hrc
+++ b/editeng/inc/editeng/memberids.hrc
@@ -134,6 +134,7 @@
 #define MID_LO_MARGIN       4
 #define MID_UP_REL_MARGIN   5
 #define MID_LO_REL_MARGIN   6
+#define MID_CTX_MARGIN      7
 
 //LRSpaceItem
 #define MID_LR_MARGIN       0
diff --git a/editeng/inc/editeng/ulspitem.hxx b/editeng/inc/editeng/ulspitem.hxx
index 7a91db0..f09a18d 100644
--- a/editeng/inc/editeng/ulspitem.hxx
+++ b/editeng/inc/editeng/ulspitem.hxx
@@ -51,6 +51,7 @@ class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem
 {
     sal_uInt16 nUpper;  // Upper space
     sal_uInt16 nLower;  // Lower space
+    sal_Bool bContext; // Contextual spacing?
     sal_uInt16 nPropUpper, nPropLower;      // relative or absolute (=100%)
 public:
     TYPEINFO();
@@ -83,11 +84,13 @@ public:
 
     void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
     void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
+    void SetContextValue( const sal_Bool bC ) { bContext = bC; }
     void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
     void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
 
     sal_uInt16 GetUpper() const { return nUpper; }
     sal_uInt16 GetLower() const { return nLower; }
+    sal_Bool GetContext() const { return bContext; }
     sal_uInt16 GetPropUpper() const { return nPropUpper; }
     sal_uInt16 GetPropLower() const { return nPropLower; }
 };
@@ -96,6 +99,7 @@ inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
 {
     nUpper = rCpy.GetUpper();
     nLower = rCpy.GetLower();
+    bContext = rCpy.GetContext();
     nPropUpper = rCpy.GetPropUpper();
     nPropLower = rCpy.GetPropLower();
     return *this;
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 849439d..f38ba5d 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -837,6 +837,7 @@ bool    SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
         }
         case MID_UP_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nUpper) : nUpper); break;
         case MID_LO_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nLower) : nLower); break;
+        case MID_CTX_MARGIN: rVal <<= bContext; break;
         case MID_UP_REL_MARGIN: rVal <<= (sal_Int16) nPropUpper; break;
         case MID_LO_REL_MARGIN: rVal <<= (sal_Int16) nPropLower; break;
     }
@@ -849,6 +850,7 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
     sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
     nMemberId &= ~CONVERT_TWIPS;
     sal_Int32 nVal = 0;
+    sal_Bool bVal = 0;
     switch( nMemberId )
     {
         case 0:
@@ -876,6 +878,11 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                 return false;
             SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal));
             break;
+        case MID_CTX_MARGIN :
+            if (!(rVal >>= bVal))
+                return false;
+            SetContextValue(bVal);
+            break;
         case MID_UP_REL_MARGIN:
         case MID_LO_REL_MARGIN:
         {
@@ -907,6 +914,7 @@ int SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const
 
     return ( nUpper == ( (SvxULSpaceItem&)rAttr ).nUpper &&
              nLower == ( (SvxULSpaceItem&)rAttr ).nLower &&
+             bContext == ( (SvxULSpaceItem&)rAttr ).bContext &&
              nPropUpper == ( (SvxULSpaceItem&)rAttr ).nPropUpper &&
              nPropLower == ( (SvxULSpaceItem&)rAttr ).nPropLower );
 }
diff --git a/offapi/com/sun/star/style/ParagraphProperties.idl b/offapi/com/sun/star/style/ParagraphProperties.idl
index ce770ee..885f320 100644
--- a/offapi/com/sun/star/style/ParagraphProperties.idl
+++ b/offapi/com/sun/star/style/ParagraphProperties.idl
@@ -152,6 +152,15 @@ published service ParagraphProperties
      */
     [property] long ParaBottomMargin;
 
+    /** determines if contextual spacing is used.
+
+        @since LibreOffice 3.6
+
+        <p>If true, the top and bottom margins of the paragraph should not be
+        applied when the previous and next paragraphs have the same style.</p>
+     */
+    [optional, property] boolean ParaContextMargin;
+
     //-------------------------------------------------------------------------
 
     /** determines if the paragraph is included in the
diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi
index a4f3c31..ef1a954 100755
--- a/svx/sdi/svxitems.sdi
+++ b/svx/sdi/svxitems.sdi
@@ -546,6 +546,7 @@ struct SvxULSpace
 {
     INT32               TopMargin       MID_UP_MARGIN;  // % or direct
     INT32               BottomMargin    MID_LO_MARGIN;  // % or direct
+    BOOL                ContextMargin   MID_CTX_MARGIN;
     INT16               TopRelMargin    MID_UP_REL_MARGIN;
     INT16               BottomRelMargin MID_LO_REL_MARGIN;
 };
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 8114f91..38911cc 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -812,7 +812,9 @@ enum SwPropNameIds
 /* 0747 */  UNO_NAME_LINE_STYLE,
 /* 0748 */  UNO_NAME_LINE_WIDTH,
 
-/* 0749 */  SW_PROPNAME_END
+/* 0749 */  UNO_NAME_PARA_CONTEXT_MARGIN,
+
+/* 0750 */  SW_PROPNAME_END
 
 // new items in this array must match SwPropNameTab aPropNameTab
 };
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index ca85a18..d3f7db1 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -209,6 +209,7 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
         { SW_PROP_NMID(UNO_NAME_PARA_REGISTER_MODE_ACTIVE), RES_PARATR_REGISTER,CPPU_E2T(CPPUTYPE_BOOLEAN)  ,           PropertyAttribute::MAYBEVOID, 0},                                                                 \
         { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN), RES_UL_SPACE,             CPPU_E2T(CPPUTYPE_INT32),           PropertyAttribute::MAYBEVOID, MID_UP_MARGIN|CONVERT_TWIPS},                                  \
         { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN), RES_UL_SPACE,          CPPU_E2T(CPPUTYPE_INT32),           PropertyAttribute::MAYBEVOID, MID_LO_MARGIN|CONVERT_TWIPS},                                 \
+        { SW_PROP_NMID(UNO_NAME_PARA_CONTEXT_MARGIN), RES_UL_SPACE,          CPPU_E2T(CPPUTYPE_BOOLEAN),           PropertyAttribute::MAYBEVOID, MID_CTX_MARGIN},                                 \
         { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN),              PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT        },                                                \
         { SW_PROP_NMID(UNO_NAME_PARA_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN),                 PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT        },                                                \
         { SW_PROP_NMID(UNO_NAME_NUMBERING_STYLE_NAME), RES_PARATR_NUMRULE,  CPPU_E2T(CPPUTYPE_OUSTRING),         PropertyAttribute::MAYBEVOID,   0},                                                           \
@@ -427,6 +428,7 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
                     { SW_PROP_NMID(UNO_NAME_PARA_REGISTER_MODE_ACTIVE), RES_PARATR_REGISTER,    CPPU_E2T(CPPUTYPE_BOOLEAN)  ,       PROPERTY_NONE, 0},\
                     { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN), RES_UL_SPACE,             CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},\
                     { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN), RES_UL_SPACE,          CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},\
+                    { SW_PROP_NMID(UNO_NAME_PARA_CONTEXT_MARGIN), RES_UL_SPACE,          CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_CTX_MARGIN},\
                     { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN_RELATIVE), RES_UL_SPACE,        CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_UP_REL_MARGIN},\
                     { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN_RELATIVE), RES_UL_SPACE,         CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_LO_REL_MARGIN},\
                     TABSTOPS_MAP_ENTRY\
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index a3f84d4..9b0f64b 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -787,6 +787,8 @@ const SwPropNameTab aPropNameTab = {
 /* 0747 UNO_NAME_LINE_STYLE */	         {MAP_CHAR_LEN("LineStyle")},
 /* 0748 UNO_NAME_LINE_WIDTH */	         {MAP_CHAR_LEN("LineWidth")},
 
+/* 0749 PARA_CONTEXT_MARGIN */           {MAP_CHAR_LEN("ParaContextMargin")},
+
 // new items in this array must match enum SwPropNameIds
 };
 


More information about the Libreoffice-commits mailing list