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

Lubos Lunak llunak at kemper.freedesktop.org
Fri May 20 05:57:07 PDT 2011


 sw/inc/IDocumentSettingAccess.hxx            |    1 +
 sw/inc/doc.hxx                               |    1 +
 sw/source/core/doc/doc.cxx                   |    5 +++++
 sw/source/core/doc/docnew.cxx                |    1 +
 sw/source/core/inc/swfont.hxx                |    3 ++-
 sw/source/core/txtnode/fntcap.cxx            |    9 +++++++--
 sw/source/core/txtnode/swfont.cxx            |    7 +++++++
 sw/source/filter/inc/wrtswtbl.hxx            |    6 +++---
 sw/source/filter/ww8/docxattributeoutput.cxx |   17 +++++++++++++++++
 sw/source/filter/xml/xmlimp.cxx              |   14 ++++++++++++++
 sw/source/ui/uno/SwXDocumentSettings.cxx     |   16 +++++++++++++++-
 11 files changed, 73 insertions(+), 7 deletions(-)

New commits:
commit 450ce7ee52672e77c6e5fe601d0ed3c416a60b16
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri May 20 14:44:03 2011 +0200

    compatibility option for old size of small caps (bnc#691473)
    
    Version 3.2 had 66 as the small capitals size percentage, later
    changed to 80 (see e.g. http://openoffice.org/bugzilla/show_bug.cgi?id=1526).
    This however can destroy layout of old documents that rely on the old
    size. So for backwards compatibility the old value is used if either
    the .odt document has an option enabled or does not have the option
    at all (meaning it's an older .odt document). There's unfortunately
    a period when the new value was already in effect where this change
    can break those documents :-/.

diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 266be7f..4e83e72 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -81,6 +81,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd
          TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
      INVERT_BORDER_SPACING,
          COLLAPSE_EMPTY_CELL_PARA,
+         SMALL_CAPS_PERCENTAGE_66,
          // COMPATIBILITY FLAGS END
 
          BROWSE_MODE,
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 4ff6238..72df51d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -580,6 +580,7 @@ private:
     bool mbInvertBorderSpacing                      : 1;
     bool mbCollapseEmptyCellPara                    : 1;
     bool mbTabAtLeftIndentForParagraphsInList;             // #i89181# - see above
+    bool mbSmallCapsPercentage66;
 
     bool mbLastBrowseMode                           : 1;
 
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index aecba23..b456ed5 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -201,6 +201,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
         case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return mbTabAtLeftIndentForParagraphsInList;
         case INVERT_BORDER_SPACING: return mbInvertBorderSpacing;
         case COLLAPSE_EMPTY_CELL_PARA: return mbCollapseEmptyCellPara;
+        case SMALL_CAPS_PERCENTAGE_66: return mbSmallCapsPercentage66;
 
         case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked!
         case HTML_MODE: return mbHTMLMode;
@@ -331,6 +332,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
         case COLLAPSE_EMPTY_CELL_PARA:
             mbCollapseEmptyCellPara = value;
             break;
+
+        case SMALL_CAPS_PERCENTAGE_66:
+            mbSmallCapsPercentage66 = value;
+            break;
          // COMPATIBILITY FLAGS END
 
         case BROWSE_MODE: //can be used temporary (load/save) when no ViewShell is avaiable
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 49d4dea..0527ab9 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -356,6 +356,7 @@ SwDoc::SwDoc()
     mbTabAtLeftIndentForParagraphsInList    = false;        // hidden #i89181#
     mbInvertBorderSpacing                   = false;        // hidden
     mbCollapseEmptyCellPara                 = true;        // hidden
+    mbSmallCapsPercentage66                 = false;        // hidden
 
     //
     // COMPATIBILITY FLAGS END
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index bd29634..c26ba79 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -58,8 +58,9 @@ class SwSubFont : public SvxFont
     sal_uInt16	 	nOrgHeight;		// Hoehe inkl. Escapement/Proportion
     sal_uInt16	 	nOrgAscent;		// Ascent inkl. Escapement/Proportion
     sal_uInt16		nPropWidth;		// proportional width
+    bool smallCapsPercentage66;
     inline SwSubFont() : aSize(0,0)
-    { pMagic = NULL; nFntIndex = nOrgHeight = nOrgAscent = 0; nPropWidth =100; }
+    { pMagic = NULL; nFntIndex = nOrgHeight = nOrgAscent = 0; nPropWidth =100; smallCapsPercentage66 = false; }
 
     sal_uInt16 CalcEscAscent( const sal_uInt16 nOldAscent ) const;
     sal_uInt16 CalcEscHeight( const sal_uInt16 nOldHeight,
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 4ee0af6..440e169 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -622,8 +622,13 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
     else
         pBigFont = pLastFont;
 
-    // Hier entsteht der Kleinbuchstabenfont:
-    aFont.SetProportion( (aFont.GetPropr() * SMALL_CAPS_PERCENTAGE ) / 100L );
+    // Older LO versions had 66 as the small caps percentage size, later changed to 80,
+    // therefore a backwards compatibility option is kept (otherwise layout is changed).
+    // NOTE: There are more uses of SMALL_CAPS_PERCENTAGE in editeng, but it seems they
+    // do not matter for Writer (and if they did it'd be pretty ugly to propagate
+    // the option there).
+    int smallCapsPercentage = smallCapsPercentage66 ? 66 : SMALL_CAPS_PERCENTAGE;
+    aFont.SetProportion( (aFont.GetPropr() * smallCapsPercentage ) / 100L );
     pMagic2 = NULL;
     nIndex2 = 0;
     SwFntAccess *pSmallFontAccess = new SwFntAccess( pMagic2, nIndex2, &aFont,
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 3dfd523..458155d 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -560,6 +560,12 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
         SetVertical( pAttrSet->GetCharRotate().GetValue() );
     else
         SetVertical( 0 );
+    if( pIDocumentSettingAccess && pIDocumentSettingAccess->get( IDocumentSettingAccess::SMALL_CAPS_PERCENTAGE_66 ))
+    {
+        aSub[ SW_LATIN ].smallCapsPercentage66 = true;
+        aSub[ SW_CJK ].smallCapsPercentage66 = true;
+        aSub[ SW_CTL ].smallCapsPercentage66 = true;
+    }
 }
 
 SwSubFont& SwSubFont::operator=( const SwSubFont &rFont )
@@ -571,6 +577,7 @@ SwSubFont& SwSubFont::operator=( const SwSubFont &rFont )
     nOrgAscent = rFont.nOrgAscent;
     nPropWidth = rFont.nPropWidth;
     aSize = rFont.aSize;
+    smallCapsPercentage66 = rFont.smallCapsPercentage66;
     return *this;
 }
 
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 2d23af0..31b97f8 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1185,6 +1185,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     aSet.insert(String("UpdateFromTemplate", RTL_TEXTENCODING_ASCII_US));
     aSet.insert(String("PrinterIndependentLayout", RTL_TEXTENCODING_ASCII_US));
     aSet.insert(String("PrintEmptyPages", RTL_TEXTENCODING_ASCII_US));
+    aSet.insert(String("SmallCapsPercentage66", RTL_TEXTENCODING_ASCII_US));
 
     sal_Int32 nCount = aConfigProps.getLength();
     const PropertyValue* pValues = aConfigProps.getConstArray();
@@ -1213,6 +1214,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     bool bClipAsCharacterAnchoredWriterFlyFrames( false );
     bool bUnixForceZeroExtLeading = false;
     bool bUseOldPrinterMetrics = false;
+    bool bSmallCapsPercentage66 = false;
 
     OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) );
 
@@ -1280,6 +1282,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
                     bUnixForceZeroExtLeading = true;
                 else if( pValues->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UseOldPrinterMetrics")) )
                     bUseOldPrinterMetrics = true;
+                else if( pValues->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("SmallCapsPercentage66")) )
+                    bSmallCapsPercentage66 = true;
             }
             catch( Exception& )
             {
@@ -1423,6 +1427,16 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
             OUString( RTL_CONSTASCII_USTRINGPARAM("UseOldPrinterMetrics") ), makeAny( true ) );
     }
 
+    // Old LO versions had 66 as the value for small caps percentage, later changed to 80.
+    // In order to keep backwards compatibility, SmallCapsPercentage66 option is written to .odt
+    // files, and the default for new documents is 'false'. Files without this option
+    // are considered to be old files, so set the compatibility option too.
+    if ( !bSmallCapsPercentage66 )
+    {
+        xProps->setPropertyValue(
+            OUString( RTL_CONSTASCII_USTRINGPARAM("SmallCapsPercentage66") ), makeAny( true ) );
+    }
+
     Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
     Reference < XText > xText = xTextDoc->getText();
     Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx
index 50c9e6e..e2014b7 100644
--- a/sw/source/ui/uno/SwXDocumentSettings.cxx
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -121,7 +121,8 @@ enum SwDocumentSettingsPropertyHandles
     HANDLE_MODIFYPASSWORDINFO,
     HANDLE_MATH_BASELINE_ALIGNMENT,
     HANDLE_INVERT_BORDER_SPACING,
-    HANDLE_COLLAPSE_EMPTY_CELL_PARA
+    HANDLE_COLLAPSE_EMPTY_CELL_PARA,
+    HANDLE_SMALL_CAPS_PERCENTAGE_66
 };
 
 MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -179,6 +180,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo()
         { RTL_CONSTASCII_STRINGPARAM("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, CPPUTYPE_BOOLEAN, 0, 0},
         { RTL_CONSTASCII_STRINGPARAM("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, CPPUTYPE_BOOLEAN, 0, 0},
         { RTL_CONSTASCII_STRINGPARAM("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, CPPUTYPE_BOOLEAN, 0, 0},
+        { RTL_CONSTASCII_STRINGPARAM("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, CPPUTYPE_BOOLEAN, 0, 0},
 /*
  * As OS said, we don't have a view when we need to set this, so I have to
  * find another solution before adding them to this property set - MTG
@@ -703,6 +705,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
             mpDoc->set(IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA, bTmp);
         }
         break;
+        case HANDLE_SMALL_CAPS_PERCENTAGE_66:
+        {
+            sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+            mpDoc->set(IDocumentSettingAccess::SMALL_CAPS_PERCENTAGE_66, bTmp);
+        }
+        break;
         default:
             throw UnknownPropertyException();
     }
@@ -1047,6 +1055,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
             rValue.setValue( &bTmp, ::getBooleanCppuType() );
         }
         break;
+        case HANDLE_SMALL_CAPS_PERCENTAGE_66:
+        {
+            sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::SMALL_CAPS_PERCENTAGE_66 );
+            rValue.setValue( &bTmp, ::getBooleanCppuType() );
+        }
+        break;
         default:
             throw UnknownPropertyException();
     }
commit 321c15e393af69a9100ce8fa018b427cf2891902
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue May 17 17:23:24 2011 +0200

    ooxml vAlign 17.4.84

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index dc28911..d3cd2b3 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1825,6 +1825,23 @@ void DocxAttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer
         m_pSerializer->singleElementNS( XML_w, XML_textDirection,
                FSNS( XML_w, XML_val ), "tbRl",
                FSEND );
+
+    const SwWriteTableRows& aRows = m_pTableWrt->GetRows( );
+    SwWriteTableRow *pRow = aRows[ pTableTextNodeInfoInner->getRow( ) ];
+    SwWriteTableCell *pCell = pRow->GetCells( )[ pTableTextNodeInfoInner->getCell( ) ];
+    switch( pCell->GetVertOri())
+    {
+        case text::VertOrientation::TOP:
+            break;
+        case text::VertOrientation::CENTER:
+            m_pSerializer->singleElementNS( XML_w, XML_vAlign,
+                FSNS( XML_w, XML_val ), "center", FSEND );
+            break;
+        case text::VertOrientation::BOTTOM:
+            m_pSerializer->singleElementNS( XML_w, XML_vAlign,
+                FSNS( XML_w, XML_val ), "bottom", FSEND );
+            break;
+    }
 }
 
 void DocxAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t /*pNodeInfo*/ )
commit 36fc16ae5b786551c3ae5227140aa90eb9c4d88b
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue May 17 17:12:43 2011 +0200

    SW_DLLPUBLIC for SwWriteTable* classes
    
    they are (to be?) used from filters

diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx
index 4d7eb4c..081f93a 100644
--- a/sw/source/filter/inc/wrtswtbl.hxx
+++ b/sw/source/filter/inc/wrtswtbl.hxx
@@ -56,7 +56,7 @@ namespace editeng { class SvxBorderLine; }
 
 //-----------------------------------------------------------------------
 
-class SwWriteTableCell
+class SW_DLLPUBLIC SwWriteTableCell
 {
     const SwTableBox *pBox;		// SwTableBox der Zelle
     const SvxBrushItem *pBackground;	// geerbter Hintergrund einer Zeile
@@ -111,7 +111,7 @@ SV_DECL_PTRARR_DEL( SwWriteTableCells, SwWriteTableCellPtr, 5, 5 )
 
 //-----------------------------------------------------------------------
 
-class SwWriteTableRow
+class SW_DLLPUBLIC SwWriteTableRow
 {
     SwWriteTableCells aCells;		// Alle Zellen der Rows
     const SvxBrushItem *pBackground;// Hintergrund
@@ -180,7 +180,7 @@ SV_DECL_PTRARR_SORT_DEL( SwWriteTableRows, SwWriteTableRowPtr, 5, 5 )
 
 //-----------------------------------------------------------------------
 
-class SwWriteTableCol
+class SW_DLLPUBLIC SwWriteTableCol
 {
     sal_uInt32 nPos;						// End Position der Spalte
 


More information about the Libreoffice-commits mailing list