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

Jian Fang Zhang zhangjf at apache.org
Fri May 31 06:11:06 PDT 2013


 sw/inc/unomap.hxx                           |    3 ++-
 sw/inc/unoprnms.hxx                         |    4 +++-
 sw/source/core/unocore/unomap.cxx           |    1 +
 sw/source/core/unocore/unoprnms.cxx         |    1 +
 sw/source/ui/uno/unotxdoc.cxx               |    8 ++++++++
 writerfilter/source/dmapper/PropertyIds.cxx |    1 +
 writerfilter/source/dmapper/PropertyIds.hxx |    1 +
 writerfilter/source/dmapper/PropertyMap.cxx |   26 +++++++++++++-------------
 8 files changed, 30 insertions(+), 15 deletions(-)

New commits:
commit 0181f258e5598ee59b1c4847818944b8da16bd51
Author: Jian Fang Zhang <zhangjf at apache.org>
Date:   Wed Sep 12 11:19:10 2012 +0000

    Resolves: #i119558# set default page mode value to false for docx
    
    To avoid default page mode affect the calculation of table row height
    
    Found by: xiao ting xiao, tingxiaox at gmail.com
    Patch by: zhaoshzh, aoo.zhaoshzh at gmail.com
    Review by: zhangjf
    
    (cherry picked from commit 28e1cb1240e7c7a274a04756c7cab2f5797de400)
    
    Conflicts:
    	sw/inc/unomap.hxx
    	sw/inc/unoprnms.hxx
    	sw/source/core/unocore/unomap.cxx
    	sw/source/core/unocore/unoprnms.cxx
    	sw/source/ui/uno/unotxdoc.cxx
    	writerfilter/source/dmapper/PropertyIds.cxx
    
    Change-Id: I41745eb9d727a5ae87d34872f9dc3f4442c7bc8d

diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 7f130a2..128570c 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -237,7 +237,8 @@
 #define WID_DOC_LOCK_UPDATES                    1016
 #define WID_DOC_HAS_VALID_SIGNATURES            1017
 #define WID_DOC_BUILDID                         1024
-#define WID_DOC_ISTEMPLATEID                        1025
+#define WID_DOC_ISTEMPLATEID                    1025
+#define WID_DOC_DEFAULT_PAGE_MODE               1069
 
 // MailMerge
 #define WID_SELECTION                           1071
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 42027af..fb6e9d3 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -820,7 +820,9 @@ enum SwPropNameIds
 /* 0758 */  UNO_NAME_FILL_GRADIENT,
 /* 0759 */  UNO_NAME_FILL_GRADIENT_NAME,
 
-/* 0760 */  SW_PROPNAME_END
+/* 0760 */  UNO_NAME_DEFAULT_PAGE_MODE,
+
+/* 0761 */  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 5f3cfc2..a9bf548 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1559,6 +1559,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                     { SW_PROP_NMID(UNO_NAME_LOCK_UPDATES),        WID_DOC_LOCK_UPDATES,     CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE,   0},
                     { SW_PROP_NMID(UNO_NAME_HAS_VALID_SIGNATURES),  WID_DOC_HAS_VALID_SIGNATURES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY,   0},
                     { SW_PROP_NMID(UNO_NAME_BUILDID), WID_DOC_BUILDID, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0},
+                    { SW_PROP_NMID(UNO_NAME_DEFAULT_PAGE_MODE),  WID_DOC_DEFAULT_PAGE_MODE,  CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE,  0},
                     {0,0,0,0,0,0}
                 };
                 aMapEntriesArr[nPropertyId] = aDocMap_Impl;
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index f1e0f19..f28e927 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -789,6 +789,7 @@ const SwPropNameTab aPropNameTab = {
 /* 0757 UNO_NAME_FILL_STYLE */              {MAP_CHAR_LEN("FillStyle")},
 /* 0758 UNO_NAME_FILL_GRADIENT */              {MAP_CHAR_LEN("FillGradient")},
 /* 0759 UNO_NAME_FILL_GRADIENT_NAME */              {MAP_CHAR_LEN("FillGradientName")},
+/* 0760 UNO_NAME_DEFAULT_PAGE_MODE */    {MAP_CHAR_LEN("DefaultPageMode")}
 
 // new items in this array must match enum SwPropNameIds
 };
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index f8d33f0..84e2930 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -1991,6 +1991,14 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName,
             aValue >>= maBuildId;
         break;
 
+        case WID_DOC_DEFAULT_PAGE_MODE:
+        {
+            bool bDefaultPageMode( false );
+            aValue >>= bDefaultPageMode;
+            pDocShell->GetDoc()->SetDefaultPageMode( bDefaultPageMode );
+        }
+        break;
+
         default:
         {
             const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pEntry->nWID);
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 86438b9..e506ee8 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -228,6 +228,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
             case PROP_GRID_LINES            :    sName = "GridLines"; break;
             case PROP_GRID_BASE_HEIGHT      :    sName = "GridBaseHeight"; break;
             case PROP_GRID_RUBY_HEIGHT      :    sName = "GridRubyHeight"; break;
+            case PROP_GRID_STANDARD_MODE     :    sName = "StandardPageMode"; break;
             case PROP_IS_ON                  :    sName = "IsOn"; break;
             case PROP_RESTART_AT_EACH_PAGE   :    sName = "RestartAtEachPage"; break;
             case PROP_COUNT_EMPTY_LINES      :    sName = "CountEmptyLines"; break;
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index 3467321..1c6b83e 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -276,6 +276,7 @@ enum PropertyIds
         ,PROP_USER_DATA_TYPE
         ,PROP_VERTICAL_MERGE
         ,PROP_VERT_MIRRORED
+/*254*/ ,PROP_GRID_STANDARD_MODE
         ,PROP_VERT_ORIENT
         ,PROP_VERT_ORIENT_POSITION
         ,PROP_VERT_ORIENT_RELATION
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 9de69fc..ebd5497 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -990,21 +990,21 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
             nRubyHeight = 0;
         operator[]( PropertyDefinition( PROP_GRID_RUBY_HEIGHT, false )) = uno::makeAny( nRubyHeight );
 
-        sal_Int16 nGridMode = text::TextGridMode::NONE;
-
-        switch (m_nGridType)
+        // #i119558#, force to set document as standard page mode,
+        // refer to ww8 import process function "SwWW8ImplReader::SetDocumentGrid"
+        try
         {
-            case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_lines:
-                nGridMode = text::TextGridMode::LINES;
-                break;
-            case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_linesAndChars:
-                nGridMode = text::TextGridMode::LINES_AND_CHARS;
-                break;
-            default:
-                break;
+            uno::Reference< beans::XPropertySet > xDocProperties;
+            xDocProperties = uno::Reference< beans::XPropertySet >( rDM_Impl.GetTextDocument(), uno::UNO_QUERY_THROW );
+            sal_Bool bSquaredPageMode = sal_False;
+            operator[]( PropertyDefinition( PROP_GRID_STANDARD_MODE, false )) = uno::makeAny( !bSquaredPageMode );
+            xDocProperties->setPropertyValue( OUString("DefaultPageMode"), uno::makeAny( bSquaredPageMode ));
+        }
+        catch (const uno::Exception& rEx)
+        {
+            OSL_ENSURE( false, "Exception in SectionPropertyMap::CloseSectionGroup");
+            (void)rEx;
         }
-
-        operator[](PropertyDefinition(PROP_GRID_MODE, false)) = uno::makeAny(nGridMode);
 
         if (rDM_Impl.IsNewDoc())
             _ApplyProperties( xFollowPageStyle );


More information about the Libreoffice-commits mailing list