ooo-build r15533 - trunk/patches/dev300



Author: cbosdo
Date: Fri Mar 13 10:58:05 2009
New Revision: 15533
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15533&view=rev

Log:
docx import fixes: page number frames too large, implemented page
borders import


Added:
   trunk/patches/dev300/writerfilter-docx-import-frames-width.diff
   trunk/patches/dev300/writerfilter-docx-import-page-borders.diff
Modified:
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Fri Mar 13 10:58:05 2009
@@ -1985,6 +1985,8 @@
 writerfilter-docx-import-graphics.diff, i#96021, i#97645, cbosdo
 writerfilter-docx-import-redlines.diff, i#91883, n#478562, cbosdo
 sw-docx-import-redlines.diff, i#91883, n#478562, cbosdo
+writerfilter-docx-import-frames-width.diff, i#93783, cbosdo
+writerfilter-docx-import-page-borders.diff, i#100176, cbosdo
 
 buildfix-oox-depends-on-unotools.diff
 

Added: trunk/patches/dev300/writerfilter-docx-import-frames-width.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/writerfilter-docx-import-frames-width.diff	Fri Mar 13 10:58:05 2009
@@ -0,0 +1,15 @@
+diff --git writerfilter/source/dmapper/DomainMapper_Impl.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx
+index 6812db4..dd2f07f 100644
+--- writerfilter/source/dmapper/DomainMapper_Impl.cxx
++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx
+@@ -833,8 +833,8 @@ void lcl_AddRangeAndStyle(
+ /*-------------------------------------------------------------------------
+ 
+   -----------------------------------------------------------------------*/
+-//define some default frame width - 10cm ATM
+-#define DEFAULT_FRAME_MIN_WIDTH 10000
++//define some default frame width - 0cm ATM: this allow the frame to be wrapped around the text
++#define DEFAULT_FRAME_MIN_WIDTH 0
+ 
+ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
+ {

Added: trunk/patches/dev300/writerfilter-docx-import-page-borders.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/writerfilter-docx-import-page-borders.diff	Fri Mar 13 10:58:05 2009
@@ -0,0 +1,229 @@
+diff --git writerfilter/source/dmapper/DomainMapper.cxx writerfilter/source/dmapper/DomainMapper.cxx
+index 97d0446..b124f75 100644
+--- writerfilter/source/dmapper/DomainMapper.cxx
++++ writerfilter/source/dmapper/DomainMapper.cxx
+@@ -28,6 +28,8 @@
+  * for a copy of the LGPLv3 License.
+  *
+  ************************************************************************/
++#include "PageBordersHandler.hxx"
++
+ #include <dmapper/DomainMapper.hxx>
+ #include <DomainMapper_Impl.hxx>
+ #include <ConversionHelper.hxx>
+@@ -3880,6 +3882,20 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
+         }
+     }
+     break;
++    case NS_ooxml::LN_EG_SectPrContents_pgBorders:
++    {
++        writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
++        if( pProperties.get( ) && pSectionContext )
++        {
++            PageBordersHandlerPtr pHandler( new PageBordersHandler );
++            pProperties->resolve( *pHandler );
++
++            // Set the borders to the context and apply them to the styles
++            pHandler->SetBorders( pSectionContext );
++            pSectionContext->SetBorderParams( pHandler->GetDisplayOffset( ) );
++        }
++    }
++    break;
+ 
+     case NS_ooxml::LN_CT_PPrBase_pStyle:
+     {
+@@ -4103,7 +4119,6 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
+     case NS_ooxml::LN_CT_Lvl_pStyle:
+         //TODO: numbering style should apply current numbering level - not yet supported
+     break;
+-
+     default:
+         {
+ #if OSL_DEBUG_LEVEL > 0
+diff --git writerfilter/source/dmapper/PropertyMap.cxx writerfilter/source/dmapper/PropertyMap.cxx
+index af17583..bef5c9b 100644
+--- writerfilter/source/dmapper/PropertyMap.cxx
++++ writerfilter/source/dmapper/PropertyMap.cxx
+@@ -175,6 +175,7 @@ void PropertyMap::insertTableProperties( const PropertyMap* )
+   -----------------------------------------------------------------------*/
+ SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
+     m_bIsFirstSection( bIsFirstSection )
++    ,m_nBorderParams( 0 )
+     ,m_bTitlePage( false )
+     ,m_nColumnCount( 0 )
+     ,m_nColumnDistance( 1249 )
+@@ -375,21 +376,6 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
+     sal_Int32 nOffsetFrom = (nValue & 0x00E0) >> 5;
+     //sal_Int32 bPageDepth = (nValue & 0x0018) >> 3; //unused infromation: 0 - in front 1 - in back
+     //todo: negative spacing (from ww8par6.cxx)
+-    if( nOffsetFrom == 1 )
+-    {
+-//        USHORT nDist;
+-//        if (aBox.GetLeft())
+-//        {
+-//            nDist = aBox.GetDistance(BOX_LINE_LEFT);
+-//    lcl_MakeSafeNegativeSpacing( ) sets the distance to 0 if  > SHRT_MAX
+-//
+-//            aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<USHORT>(aLR.GetLeft() - nDist)), BOX_LINE_LEFT);
+-//            aSizeArray[WW8_LEFT] =
+-//                aSizeArray[WW8_LEFT] - nDist + aBox.GetDistance(BOX_LINE_LEFT);
+-//        }
+-        //the same for right, top, bottom
+-
+-    }
+     switch( nValue & 0x07)
+     {
+         case 0: /*all styles*/
+@@ -420,8 +406,16 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
+         PROP_LEFT_BORDER_DISTANCE,
+         PROP_RIGHT_BORDER_DISTANCE,
+         PROP_TOP_BORDER_DISTANCE,
+-        PROP_BOTTOM_BORDER_DISTANCE,
++        PROP_BOTTOM_BORDER_DISTANCE
+     };
++    static const PropertyIds aMarginIds[4] = 
++    {
++        PROP_LEFT_MARGIN,
++        PROP_RIGHT_MARGIN,
++        PROP_TOP_MARGIN,
++        PROP_BOTTOM_MARGIN
++    };
++
+     PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
+     for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder)
+     {
+@@ -434,19 +428,38 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
+         }
+         if( m_nBorderDistances[nBorder] >= 0 )
+         {
+-            const ::rtl::OUString sBorderDistanceName = rPropNameSupplier.GetName( aBorderDistanceIds[nBorder] );
+-            xFirst->setPropertyValue( sBorderDistanceName, uno::makeAny( m_nBorderDistances[nBorder] ));
++            SetBorderDistance( xFirst, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
++                  m_nBorderDistances[nBorder], nOffsetFrom );
+             if(xSecond.is())
+-                xSecond->setPropertyValue( sBorderDistanceName, uno::makeAny( m_nBorderDistances[nBorder] ));
++                SetBorderDistance( xSecond, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
++                      m_nBorderDistances[nBorder], nOffsetFrom );
+         }
+     }
++}
+ 
+-//                rContext->Insert( aBorderIds[nId - 0x702B], uno::makeAny( aBorderLine ));
+-//                rContext->Insert( aBorderDistanceIds[nId - 0x702B], uno::makeAny( nLineDistance) );
+-
+-//    uno::Reference< beans::XPropertySet > xStyle = GetPageStyle( ePageType );
++void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > xStyle, 
++        PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom )
++{ 
++    PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
+ 
++    sal_Int32 nDist = nDistance;
++    if( nOffsetFrom == 1 )
++    {
++        const ::rtl::OUString sMarginName = rPropNameSupplier.GetName( eMarginId );
++        uno::Any aMargin = xStyle->getPropertyValue( sMarginName );
++        sal_Int32 nMargin;
++        aMargin >>= nMargin;
++    
++        // Change the margins with the border distance
++        xStyle->setPropertyValue( sMarginName, uno::makeAny( nDistance ) );
++    
++        // Set the distance to ( Margin - distance )
++        nDist = nMargin - nDistance;
++    }
++    const ::rtl::OUString sBorderDistanceName = rPropNameSupplier.GetName( eDistId );
++    xStyle->setPropertyValue( sBorderDistanceName, uno::makeAny( nDist ));
+ }
++
+ /*-- 14.12.2006 12:50:06---------------------------------------------------
+ 
+   -----------------------------------------------------------------------*/
+@@ -764,6 +777,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
+             uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle(
+                                 rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true );
+             _ApplyProperties( xFirstPageStyle );
++
+             sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0;
+             if( nPaperBin )
+                 xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) );
+@@ -771,6 +785,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
+                 xFollowPageStyle->setPropertyValue(
+                     rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ));
+         }
++            
++        ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams );
++
+         try
+         {
+ //            if( m_xStartingRange.is() )
+diff --git writerfilter/source/dmapper/PropertyMap.hxx writerfilter/source/dmapper/PropertyMap.hxx
+index c6736fe..3060ef4 100644
+--- writerfilter/source/dmapper/PropertyMap.hxx
++++ writerfilter/source/dmapper/PropertyMap.hxx
+@@ -158,6 +158,7 @@ class SectionPropertyMap : public PropertyMap
+ 
+     ::com::sun::star::table::BorderLine*    m_pBorderLines[4];
+     sal_Int32                               m_nBorderDistances[4];
++    sal_Int32                               m_nBorderParams;
+ 
+     bool                                    m_bTitlePage;
+     sal_Int16                               m_nColumnCount;
+@@ -202,6 +203,9 @@ class SectionPropertyMap : public PropertyMap
+     bool HasHeader( bool bFirstPage ) const;
+     bool HasFooter( bool bFirstPage ) const;
+ 
++    void SetBorderDistance( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle, 
++        PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom );
++
+ public:
+         explicit SectionPropertyMap(bool bIsFirstSection);
+         ~SectionPropertyMap();
+@@ -227,6 +231,7 @@ public:
+             bool bFirst );
+ 
+     void SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const ::com::sun::star::table::BorderLine& rBorderLine );
++    void SetBorderParams( sal_Int32 nSet ) { m_nBorderParams = nSet; }
+ 
+     void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; }
+     void SetColumnDistance( sal_Int32 nDist ) { m_nColumnDistance = nDist; }
+diff --git writerfilter/source/dmapper/makefile.mk writerfilter/source/dmapper/makefile.mk
+index e7235cc..5f42164 100644
+--- writerfilter/source/dmapper/makefile.mk
++++ writerfilter/source/dmapper/makefile.mk
+@@ -66,7 +66,8 @@ SLOFILES=           $(SLO)$/BorderHandler.obj \
+                     $(SLO)$/ThemeTable.obj \
+                     $(SLO)$/SettingsTable.obj \
+                     $(SLO)$/ModelEventListener.obj\
+-                    $(SLO)$/OLEHandler.obj
++                    $(SLO)$/OLEHandler.obj \
++                    $(SLO)$/PageBordersHandler.obj 
+ 
+ # --- Targets ----------------------------------
+ 
+diff --git writerfilter/source/ooxml/model.xml writerfilter/source/ooxml/model.xml
+index b6ab5a7..b9625b8 100644
+--- writerfilter/source/ooxml/model.xml
++++ writerfilter/source/ooxml/model.xml
+@@ -15483,19 +15483,19 @@
+         </group>
+         <optional>
+           <attribute name="zOrder">
+-            <text/>
++            <ref name="ST_PageBorderZOrder"/>
+             <xs:documentation>Z-Ordering of Page Border</xs:documentation>
+           </attribute>
+         </optional>
+         <optional>
+           <attribute name="display">
+-            <text/>
++            <ref name="ST_PageBorderDisplay"/>
+             <xs:documentation>Pages to Display Page Borders</xs:documentation>
+           </attribute>
+         </optional>
+         <optional>
+           <attribute name="offsetFrom">
+-            <text/>
++            <ref name="ST_PageBorderOffset"/>
+             <xs:documentation>Page Border Positioning</xs:documentation>
+           </attribute>
+         </optional>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]