[ooo-build-commit] Branch 'ooo/master' - starmath/source sw/inc sw/source

Jan Holesovsky kendy at kemper.freedesktop.org
Sat Jun 13 19:19:38 PDT 2009


 starmath/source/unomodel.cxx            |   28 ----
 sw/inc/bookmrk.hxx                      |  218 ++++++++++++++++++++++++++++++++
 sw/source/core/doc/docdesc.cxx          |    4 
 sw/source/core/doc/poolfmt.cxx          |    2 
 sw/source/core/unocore/unostyle.cxx     |    5 
 sw/source/core/view/vprint.cxx          |    2 
 sw/source/filter/basflt/shellio.cxx     |    5 
 sw/source/filter/rtf/swparrtf.cxx       |   10 -
 sw/source/filter/rtf/wrtrtf.cxx         |    5 
 sw/source/filter/ww8/dump/ww8scan.cxx   |    2 
 sw/source/filter/ww8/writerwordglue.cxx |   49 -------
 sw/source/filter/ww8/writerwordglue.hxx |   19 --
 sw/source/filter/ww8/ww8atr.cxx         |    9 -
 sw/source/filter/ww8/ww8par6.cxx        |   13 -
 sw/source/filter/ww8/ww8scan.cxx        |    2 
 sw/source/filter/ww8/ww8scan.hxx        |    5 
 sw/source/ui/app/appenv.cxx             |    5 
 sw/source/ui/dochdl/swdtflvr.cxx        |    2 
 sw/source/ui/envelp/envfmt.cxx          |   26 +--
 sw/source/ui/envelp/envimg.cxx          |    5 
 sw/source/ui/frmdlg/colex.cxx           |    2 
 sw/source/ui/inc/colex.hxx              |    3 
 sw/source/ui/uiview/pview.cxx           |    2 
 sw/source/ui/uiview/viewport.cxx        |    5 
 24 files changed, 275 insertions(+), 153 deletions(-)

New commits:
commit a79f89d42661519e5a17b995f013342bca0805dd
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date:   Fri Jun 12 09:36:34 2009 +0000

    CWS-TOOLING: integrate CWS unifypaper01
    2009-05-27 17:14:41 +0200 cmc  r272362 : #i92819#, psprint moved into vcl
    2009-05-19 15:45:46 +0200 cmc  r272083 : #i92819# having difficultly in getting this right under windows
    2009-05-18 18:04:22 +0200 cmc  r272043 : #i92819# missing some export magic somewhere
    2009-05-18 15:34:18 +0200 cmc  r272028 : #i92819# get depends right
    2009-05-18 11:50:43 +0200 cmc  r272010 : ##i92819# fix import/export stuff
    2009-05-18 10:07:00 +0200 cmc  r272000 : #i92819# fix window imp name
    2009-05-16 15:17:23 +0200 cmc  r271975 : #i92819# fix win paper names
    2009-05-16 11:11:29 +0200 cmc  r271974 : #i92819# std::abs prolematic for msvc
    2009-05-15 15:36:56 +0200 cmc  r271941 : #i92819# handle missing setting, at least on mac
    2009-05-15 10:13:44 +0200 cmc  r271927 : #i92819# adjust for moved page dialog
    2009-05-14 13:47:14 +0200 cmc  r271887 : remove dead files that reappeared
    2009-05-14 09:57:17 +0200 cmc  r271872 : CWS-TOOLING: rebase CWS unifypaper01 to trunk at 271830 (milestone: DEV300:m48)
    2009-05-11 12:27:18 +0200 cmc  r271763 : #i92819# check return value
    2009-05-06 17:28:25 +0200 cmc  r271602 : #i92819# these B4/B5s are the JIS ones according to their dimensions
    2009-05-06 17:17:03 +0200 cmc  r271601 : #i92819# micro-optimization
    2009-05-03 18:20:48 +0200 cmc  r271434 : #i92819# paper libs
    2009-05-03 16:08:32 +0200 cmc  r271433 : CWS-TOOLING: rebase CWS unifypaper01 to trunk at 271427 (milestone: DEV300:m47)
    2009-04-06 15:33:37 +0200 cmc  r270556 : CWS-TOOLING: rebase CWS unifypaper01 to trunk at 270033 (milestone: DEV300:m45)
    2009-03-12 14:36:35 +0100 cmc  r269415 : #i92819# merge paper utilities
    2009-03-11 13:44:27 +0100 cmc  r269328 : CWS-TOOLING: rebase CWS unifypaper01 to trunk at 269297 (milestone: DEV300:m43)
    2009-03-09 14:42:07 +0100 cmc  r269190 : remove config_office from synced version
    2009-03-09 14:34:50 +0100 cmc  r269187 : CWS-TOOLING: rebase CWS unifypaper01 to trunk at 268395 (milestone: DEV300:m42)
    2009-03-09 12:11:29 +0100 cmc  r269077 : CWS-TOOLING: rebase CWS unifypaper01 to trunk at 265758 (milestone: DEV300:m38)
    2009-03-06 17:17:39 +0100 cmc  r269027 : #i92819# paper goo
    2008-12-04 11:29:30 +0100 cmc  r264826 : CWS-TOOLING: rebase CWS unifypaper01 to trunk at 264807 (milestone: DEV300:m37)
    2008-11-26 10:33:06 +0100 cmc  r264357 : CWS-TOOLING: rebase CWS unifypaper01 to trunk at 264325 (milestone: DEV300:m36)
    2008-11-21 14:09:36 +0100 cmc  r264138 : #i92819# paper consolidation

diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 0dfffbd..8339e4e 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -862,30 +862,6 @@ sal_Int32 SAL_CALL SmModel::getRendererCount(
     return 1;
 }
 
-
-static Size lcl_GuessPaperSize()
-{
-    Size aRes;
-    Reference< XMultiServiceFactory >  xMgr( getProcessServiceFactory() );
-    LocaleDataWrapper aLocWrp( xMgr, AllSettings().GetLocale() );
-    if( MEASURE_METRIC == aLocWrp.getMeasurementSystemEnum() )
-    {
-        // in Twip
-        aRes.Width()  = lA4Width;
-        aRes.Height() = lA4Height;
-    }
-    else
-    {
-        // in Twip
-        aRes.Width()  = lLetterWidth;
-        aRes.Height() = lLetterHeight;
-    }
-    aRes = OutputDevice::LogicToLogic( aRes, MapMode(MAP_TWIP),
-                                             MapMode(MAP_100TH_MM) );
-    return aRes;
-}
-
-
 uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer(
         sal_Int32 nRenderer,
         const uno::Any& /*rSelection*/,
@@ -909,7 +885,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer(
     // if paper size is 0 (usually if no 'real' printer is found),
     // guess the paper size
     if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0)
-        aPrtPaperSize = lcl_GuessPaperSize();
+        aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MAP_100TH_MM);
     awt::Size   aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() );
 
     uno::Sequence< beans::PropertyValue > aRenderer(1);
@@ -978,7 +954,7 @@ void SAL_CALL SmModel::render(
                 // no real printer ??
                 if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0)
                 {
-                    aPrtPaperSize = lcl_GuessPaperSize();
+                    aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MAP_100TH_MM);
                     // factors from Windows DIN A4
                     aOutputSize    = Size( (long)(aPrtPaperSize.Width()  * 0.941),
                                            (long)(aPrtPaperSize.Height() * 0.961));
diff --git a/sw/inc/bookmrk.hxx b/sw/inc/bookmrk.hxx
new file mode 100644
index 0000000..991b401
--- /dev/null
+++ b/sw/inc/bookmrk.hxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bookmrk.hxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BOOKMRK_HXX
+#define _BOOKMRK_HXX
+
+#include "hintids.hxx"		//die Ids der Attribute, vor macitem damit die
+                            //die Attribut richtig angezogen werden.
+#include <svtools/macitem.hxx>
+
+#ifndef _KEYCOD_HXX //autogen
+#include <vcl/keycod.hxx>
+#endif
+#ifndef _TOOLS_REF_HXX
+#include <tools/ref.hxx>
+#endif
+#include <IDocumentBookmarkAccess.hxx>
+#include <calbck.hxx>
+#include <pam.hxx>
+
+#ifndef SW_DECL_SWSERVEROBJECT_DEFINED
+#define SW_DECL_SWSERVEROBJECT_DEFINED
+SV_DECL_REF( SwServerObject )
+#endif
+
+
+struct SwPosition;	// fwd Decl. wg. UI
+
+class SwBookmark : public SwModify
+{
+    SwPosition *pPos1, *pPos2;	// wird im CTOR gesetzt, im DTOR geloescht
+                                // pPos1 is always != 0, pPos2 may be 0
+    SwServerObjectRef refObj;	// falls DataServer -> Pointer gesetzt
+
+protected:
+    String		aName;
+    String		aShortName;
+    KeyCode		aCode;
+    IDocumentBookmarkAccess::BookmarkType eMarkType;
+
+    SwBookmark( const SwPosition& aPos,
+                const KeyCode& rCode,
+                const String& rName, const String& rShortName);
+
+public:
+    TYPEINFO();
+
+    SwBookmark( const SwPosition& aPos );
+    // --> OD 2007-09-26 #i81002#
+    SwBookmark( const SwPaM& aPaM,
+                const KeyCode& rCode,
+                const String& rName, const String& rShortName);
+    // <--
+
+    // Beim Loeschen von Text werden Bookmarks mitgeloescht!
+    virtual ~SwBookmark();
+
+    // --> OD 2007-10-10 #i81002#
+    // made virtual and thus no longer inline
+    virtual const SwPosition& GetBookmarkPos() const;
+    virtual const SwPosition* GetOtherBookmarkPos() const;
+    // <--
+
+    // nicht undofaehig
+    const String& GetName() const { return aName; }
+    // nicht undofaehig
+    const String& GetShortName() const { return aShortName; }
+    // nicht undofaehig
+    const KeyCode& GetKeyCode() const { return aCode; }
+
+    // Vergleiche auf Basis der Dokumentposition
+    BOOL operator < (const SwBookmark &) const;
+    BOOL operator ==(const SwBookmark &) const;
+    // falls man wirklich auf gleiche Position abfragen will.
+    BOOL IsEqualPos( const SwBookmark &rBM ) const;
+
+    BOOL IsFormFieldMark() const 	{ return IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT == eMarkType; }
+    BOOL IsBookMark() const 	{ return IDocumentBookmarkAccess::BOOKMARK == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT == eMarkType; }
+//    // --> OD 2007-10-17 #TESTING#
+//    BOOL IsBookMark() const
+//    {
+//        return IDocumentBookmarkAccess::BOOKMARK == eMarkType ||
+//               IsCrossRefMark();
+//    }
+//    // <--
+    BOOL IsMark() const 		{ return IDocumentBookmarkAccess::MARK == eMarkType; }
+    BOOL IsUNOMark() const      { return IDocumentBookmarkAccess::UNO_BOOKMARK == eMarkType; }
+    // --> OD 2007-10-11 #i81002# - bookmark type for cross-references
+    BOOL IsCrossRefMark() const { return IDocumentBookmarkAccess::CROSSREF_BOOKMARK == eMarkType; }
+    // <--
+    void SetType( IDocumentBookmarkAccess::BookmarkType eNewType )  { eMarkType = eNewType; }
+    IDocumentBookmarkAccess::BookmarkType GetType() const 	{ return eMarkType; }
+
+        // Daten Server-Methoden
+    void SetRefObject( SwServerObject* pObj );
+    const SwServerObject* GetObject() const		{  return &refObj; }
+          SwServerObject* GetObject() 			{  return &refObj; }
+    BOOL IsServer() const 						{  return refObj.Is(); }
+
+    // --> OD 2007-10-10 #i81002#
+    // made virtual and thus no longer inline
+    // to access start and end of a bookmark.
+    // start and end may be the same
+    virtual const SwPosition* BookmarkStart() const;
+    virtual const SwPosition* BookmarkEnd() const;
+    // <--
+
+    // --> OD 2007-09-26 #i81002#
+    virtual void SetBookmarkPos( const SwPosition* pNewPos1 );
+    virtual void SetOtherBookmarkPos( const SwPosition* pNewPos2 );
+    // <--
+
+private:
+    // fuer METWARE:
+    // es wird (vorerst) nicht kopiert und nicht zugewiesen
+    SwBookmark(const SwBookmark &);
+    SwBookmark &operator=(const SwBookmark &);
+};
+
+class SwMark: public SwBookmark
+{
+public:
+    SwMark( const SwPosition& aPos,
+            const KeyCode& rCode,
+            const String& rName, const String& rShortName);
+};
+            
+class SW_DLLPUBLIC SwFieldBookmark : public SwBookmark
+{
+private:
+    int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List
+    int ffres;
+    bool ffprot;
+    bool ffsize; // 0 = Auto, 1=Exact (see ffhps)
+    int fftypetxt; // Type of text field: 0 = Regular text, 1 = Number, 2 = Date, 3 = Current date, 4 = Current time, 5 = Calculation
+    bool ffrecalc; 
+    int ffmaxlen; // Number of characters for text field. Zero means unlimited.
+    int ffhps; // Check box size (half-point sizes).
+
+    String ffname;
+    String ffhelptext;
+
+public:
+    SwFieldBookmark(const SwPosition& aPos,
+           const KeyCode& rCode,
+           const String& rName, const String& rShortName,
+           IDocumentBookmarkAccess::BookmarkType eMark);
+
+    void SetFieldType(int fftype);
+    int GetFieldType();
+
+    void SetChecked(bool checked);
+    bool IsChecked();
+
+    void SetFFName(String aNewName) {
+        this->ffname=aNewName;
+    }
+
+    String GetFFName()
+    {
+        return ffname;
+    }
+
+    int GetFFRes() {
+        return ffres;
+    }
+
+    void SetFFRes(int nNew) {
+        this->ffres=nNew;
+    }
+
+    void SetFFHelpText(String newffhelptext) {
+        this->ffhelptext=newffhelptext;
+    }
+
+    String GetFFHelpText() {
+        return ffhelptext;
+    }
+};
+            
+class SwUNOMark: public SwBookmark
+{
+public:
+    // --> OD 2007-09-26 #i81002#
+    SwUNOMark( const SwPaM& aPaM,
+               const KeyCode& rCode,
+               const String& rName, const String& rShortName);
+    // <--
+};
+
+
+#endif
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 64d66b8..477d70e 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -92,9 +92,7 @@ static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId,
     // <--
 
     SwFmtFrmSize aFrmSize( ATT_FIX_SIZE );
-    SvxPaper ePaper = SvxPaperInfo::GetDefaultSvxPaper(
-        static_cast<LanguageType>( GetAppLanguage() ) );
-    const Size aPhysSize = SvxPaperInfo::GetPaperSize( ePaper );
+    const Size aPhysSize = SvxPaperInfo::GetDefaultPaperSize();
     aFrmSize.SetSize( aPhysSize );
 
     //Auf Default-Raender vorbereiten.
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 3580b03..a70fb9a 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -1566,7 +1566,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
         {
             aLR.SetLeft( 0 ); aLR.SetRight( 0 );
             aUL.SetUpper( 0 ); aUL.SetLower( 0 );
-            Size aPSize( SvxPaperInfo::GetPaperSize( SVX_PAPER_C65 ) );
+            Size aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65 ) );
             LandscapeSwap( aPSize );
             aSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aPSize.Width(), aPSize.Height() ));
             aSet.Put( aLR );
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index adc56fd..6033541 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -3025,10 +3025,7 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault(  )
                             // --> OD 2008-07-25 #i91928#
 //                            aFrmSz.SetWidth( LONG_MAX );
 //                            aFrmSz.SetHeight( LONG_MAX );
-                            SvxPaper ePaper = SvxPaperInfo::GetDefaultSvxPaper(
-                                static_cast<LanguageType>( GetAppLanguage() ) );
-                            const Size aPhysSize = SvxPaperInfo::GetPaperSize( ePaper );
-                            aFrmSz.SetSize( aPhysSize );
+                            aFrmSz.SetSize( SvxPaperInfo::GetDefaultPaperSize() );
                             // <--
                         }
 
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 7a727b6..965fda8 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -1297,7 +1297,7 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress,
                                             aSize.Width() = aSize.Height();
                                             aSize.Height() = nWidth;
                                     }
-                                    Paper ePaper = SvxPaperInfo::GetSvPaper(aSize,MAP_TWIP,TRUE);
+                                    Paper ePaper = SvxPaperInfo::GetSvxPaper(aSize,MAP_TWIP,TRUE);
                                     if ( PAPER_USER == ePaper )
                                             pPrt->SetPaperSizeUser( aSize );
                                     else
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 3d547ea..8182f28 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -882,8 +882,9 @@ ULONG SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName )
         {
             SwPageDesc aNew( rPgDsc );
             SwFmtFrmSize aNewSz( rSz );
-            aNewSz.SetHeight( lA4Height );
-            aNewSz.SetWidth( lA4Width );
+            Size a4(SvxPaperInfo::GetPaperSize( PAPER_A4 ));
+            aNewSz.SetHeight( a4.Width() );
+            aNewSz.SetWidth( a4.Height() );
             aNew.GetMaster().SetFmtAttr( aNewSz );
             pOutDoc->ChgPageDesc( 0, aNew );
         }
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index aaf8b5d..6900057 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -118,6 +118,7 @@
 #include <svx/xlnwtit.hxx>
 #include <svx/svdoutl.hxx>
 #include <svx/outlobj.hxx>
+#include <svx/paperinf.hxx>
 
 #include <tools/stream.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
@@ -3295,7 +3296,8 @@ void SwRTFParser::ReadPageDescTbl()
 
     SvxULSpaceItem aUL( RES_UL_SPACE ), aHUL( RES_UL_SPACE ), aFUL( RES_UL_SPACE );
     SvxLRSpaceItem aLR( RES_LR_SPACE ), aHLR( RES_LR_SPACE ), aFLR( RES_LR_SPACE );
-    SwFmtFrmSize aSz( ATT_FIX_SIZE, 11905, 16837 );     // DIN A4 defaulten
+    Size a4 = SvxPaperInfo::GetPaperSize(PAPER_A4);
+    SwFmtFrmSize aSz( ATT_FIX_SIZE, a4.Width(), a4.Height() );     // DIN A4 defaulten
     SwFmtFrmSize aFSz( ATT_MIN_SIZE ), aHSz( ATT_MIN_SIZE );
 
     SvxFrameDirectionItem aFrmDir(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR);
@@ -3358,8 +3360,7 @@ void SwRTFParser::ReadPageDescTbl()
 #ifndef CFRONT
     SETPAGEDESC_DEFAULTS:
 #endif
-            // aSz = pPgFmt->GetFrmSize();
-            aSz.SetWidth( 11905 ); aSz.SetHeight( 16837 );      // DIN A4 defaulten
+            aSz.SetWidth( a4.Width() ); aSz.SetHeight( a4.Height() );
             aLR.SetLeft( 0 );   aLR.SetRight( 0 );
             aUL.SetLower( 0 );  aUL.SetUpper( 0 );
             aHLR.SetLeft( 0 );  aHLR.SetRight( 0 );
@@ -3415,8 +3416,7 @@ void SwRTFParser::ReadPageDescTbl()
             aHUL.SetLower( 0 ); aHUL.SetUpper( 0 );
             aFLR.SetLeft( 0 );  aFLR.SetRight( 0 );
             aFUL.SetLower( 0 ); aFUL.SetUpper( 0 );
-//          aSz = pPgFmt->GetFrmSize();
-            aSz.SetWidth( 11905 ); aSz.SetHeight( 16837 );      // DIN A4 defaulten
+            aSz.SetWidth( a4.Width() ); aSz.SetHeight( a4.Height() ); // DIN A4 default
             nCols = USHRT_MAX; nColSpace = USHRT_MAX; nAktCol = 0;
             aFSz.SetHeightSizeType( ATT_MIN_SIZE ); aFSz.SetHeight( 0 );
             aHSz.SetHeightSizeType( ATT_MIN_SIZE ); aHSz.SetHeight( 0 );
diff --git a/sw/source/filter/rtf/wrtrtf.cxx b/sw/source/filter/rtf/wrtrtf.cxx
index bdef954..7f2179d 100644
--- a/sw/source/filter/rtf/wrtrtf.cxx
+++ b/sw/source/filter/rtf/wrtrtf.cxx
@@ -440,8 +440,9 @@ void SwRTFWriter::MakeHeader()
             if( LONG_MAX == rSz.GetHeight() || LONG_MAX == rSz.GetWidth() )
             {
                 Strm() << OOO_STRING_SVTOOLS_RTF_PAPERH;
-                OutULong( lA4Height ) << OOO_STRING_SVTOOLS_RTF_PAPERW;
-                OutULong( lA4Width );
+                Size a4 = SvxPaperInfo::GetPaperSize(PAPER_A4);
+                OutULong( a4.Height() ) << OOO_STRING_SVTOOLS_RTF_PAPERW;
+                OutULong( a4.Width() );
             }
             else
             {
diff --git a/sw/source/filter/ww8/dump/ww8scan.cxx b/sw/source/filter/ww8/dump/ww8scan.cxx
index 2852693..cdbee63 100644
--- a/sw/source/filter/ww8/dump/ww8scan.cxx
+++ b/sw/source/filter/ww8/dump/ww8scan.cxx
@@ -6661,7 +6661,7 @@ SEPr::SEPr() :
     dttmPropRMark(0), dxtCharSpace(0), dyaLinePitch(0), clm(0), reserved1(0),
     dmOrientPage(0), iHeadingPgn(0), pgnStart(1), lnnMin(0), wTextFlow(0),
     reserved2(0), pgbApplyTo(0), pgbPageDepth(0), pgbOffsetFrom(0),
-    xaPage(12240), yaPage(15840), xaPageNUp(12240), yaPageNUp(15840),
+    xaPage(12242), yaPage(15842), xaPageNUp(12242), yaPageNUp(15842),
     dxaLeft(1800), dxaRight(1800), dyaTop(1440), dyaBottom(1440), dzaGutter(0),
     dyaHdrTop(720), dyaHdrBottom(720), ccolM1(0), fEvenlySpaced(1),
     reserved3(0), fBiDi(0), fFacingCol(0), fRTLGutter(0), fRTLAlignment(0), 
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index a503d28..e91e2ae 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -69,23 +69,6 @@
 
 namespace myImplHelpers
 {
-    class closeenough : public std::unary_function<long, bool>
-    {
-    private:
-        long mnValue;
-        long mnWriggleRoom;
-    public:
-        closeenough(long nValue, long nWriggleRoom)
-            : mnValue(nValue), mnWriggleRoom(nWriggleRoom) {}
-        bool operator()(long nTest) const
-        {
-            return (
-                    (mnValue - nTest < mnWriggleRoom) &&
-                    (mnValue - nTest > -mnWriggleRoom)
-                   );
-        }
-    };
-
     SwTwips CalcHdFtDist(const SwFrmFmt& rFmt, sal_uInt16 nSpacing)
     {
         /*
@@ -400,38 +383,6 @@ namespace myImplHelpers
 
 namespace sw
 {
-    namespace types
-    {
-        long SnapPageDimension(long nSize) throw()
-        {
-            static const long aSizes[] =
-            {
-                lA0Width, lA0Height, lA1Width, lA2Width, lA3Width, lA4Width,
-                lA5Width, lB4Width, lB4Height, lB5Width, lB6Width, lC4Width,
-                lC4Height, lC5Width, lC6Width, lC65Width, lC65Height, lDLWidth,
-                lDLHeight, lJISB4Width, lJISB4Height, lJISB5Width, lJISB6Width,
-                lLetterWidth, lLetterHeight, lLegalHeight, lTabloidWidth,
-                lTabloidHeight, lDiaWidth, lDiaHeight, lScreenWidth,
-                lScreenHeight, lAWidth, lAHeight, lBHeight, lCHeight, lDHeight,
-                lEHeight, lExeWidth, lExeHeight, lLegal2Width, lLegal2Height,
-                lCom675Width, lCom675Height, lCom9Width, lCom9Height,
-                lCom10Width, lCom10Height, lCom11Width, lCom11Height,
-                lCom12Width, lMonarchHeight, lKai16Width, lKai16Height,
-                lKai32Width, lKai32BigWidth, lKai32BigHeight
-            };
-
-            const long nWriggleRoom = 5;
-            const long *pEnd = aSizes + sizeof(aSizes) / sizeof(aSizes[0]);
-            const long *pEntry =
-                std::find_if(aSizes, pEnd, myImplHelpers::closeenough(nSize, nWriggleRoom));
-
-            if (pEntry != pEnd)
-                nSize = *pEntry;
-
-            return nSize;
-        }
-    }
-
     namespace util
     {
 
diff --git a/sw/source/filter/ww8/writerwordglue.hxx b/sw/source/filter/ww8/writerwordglue.hxx
index 7a2ef7b..88bf6a7 100644
--- a/sw/source/filter/ww8/writerwordglue.hxx
+++ b/sw/source/filter/ww8/writerwordglue.hxx
@@ -94,25 +94,6 @@ namespace sw
         {
             return ww::needed_cast<Ret, Param>(in);
         }
-
-
-        /** If a page dimension is close to a standard page size, snap to it.
-
-            Commonly a page dimension is slightly different from a standard
-            page size, so close that its likely a rounding error after
-            creeping in. Use this to snap to standard sizes when within a
-            trivial distance from a standard size.
-
-            @param
-            nSize the dimension to test against standard dimensions
-
-            @return New dimension to use, equal to nSize unless within a
-            trivial amount of a standard page dimension
-
-            @author
-            <a href="mailto:cmc at openoffice.org">Caol&aacute;n McNamara</a>
-        */
-        long SnapPageDimension(long nSize) throw();
     }
 
     namespace util
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index b267a30..a0764a5 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -77,9 +77,7 @@
 #include <svx/shdditem.hxx>
 #include <svx/akrnitem.hxx>
 #include <svx/pbinitem.hxx>
-#ifndef _SVX_EMPHITEM_HXX
 #include <svx/emphitem.hxx>
-#endif
 #include <svx/twolinesitem.hxx>
 #include <svx/charscaleitem.hxx>
 #include <svx/charrotateitem.hxx>
@@ -89,6 +87,7 @@
 #include <svx/frmdiritem.hxx>
 #include <svx/blnkitem.hxx>
 #include <svx/charhiddenitem.hxx>
+#include <svx/paperinf.hxx>
 #include <fmtfld.hxx>
 #include <fchrfmt.hxx>
 #include <fmtfsize.hxx>
@@ -184,7 +183,7 @@ static Writer& OutWW8_SwNumRuleItem( Writer& rWrt, const SfxPoolItem& rHt );
 
 /*
 Sadly word does not have two different sizes for asian font size and western
-font size, it has to different fonts, but not sizes, so we have to use our
+font size, it has two different fonts, but not sizes, so we have to use our
 guess as to the script used and disable the export of one type. The same
 occurs for font weight and posture (bold and italic)
 
@@ -3424,7 +3423,7 @@ static Writer& OutWW8_SwFrmSize( Writer& rWrt, const SfxPoolItem& rHt )
         else
             rWW8Wrt.pO->Insert( 164, rWW8Wrt.pO->Count() );
         rWW8Wrt.InsUInt16(
-            msword_cast<sal_uInt16>(SnapPageDimension(rSz.GetWidth())));
+            msword_cast<sal_uInt16>(SvxPaperInfo::GetSloppyPaperDimension(rSz.GetWidth())));
 
         /*sprmSYaPage*/
         if( rWW8Wrt.bWrtWW8 )
@@ -3432,7 +3431,7 @@ static Writer& OutWW8_SwFrmSize( Writer& rWrt, const SfxPoolItem& rHt )
         else
             rWW8Wrt.pO->Insert( 165, rWW8Wrt.pO->Count() );
         rWW8Wrt.InsUInt16(
-            msword_cast<sal_uInt16>(SnapPageDimension(rSz.GetHeight())));
+            msword_cast<sal_uInt16>(SvxPaperInfo::GetSloppyPaperDimension(rSz.GetHeight())));
     }
     return rWrt;
 }
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index f5d1e1c..01fd6a6 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -444,7 +444,7 @@ void wwSectionManager::SetPage(SwPageDesc &rInPageDesc, SwFrmFmt &rFmt,
     // 2. Papiergroesse
     SwFmtFrmSize aSz( rFmt.GetFrmSize() );
     aSz.SetWidth(rSection.GetPageWidth());
-    aSz.SetHeight(SnapPageDimension(rSection.GetPageHeight()));
+    aSz.SetHeight(SvxPaperInfo::GetSloppyPaperDimension(rSection.GetPageHeight()));
     rFmt.SetFmtAttr(aSz);
 
     rFmt.SetFmtAttr(
@@ -788,8 +788,8 @@ void SwWW8ImplReader::HandleLineNumbering(const wwSection &rSection)
 
 wwSection::wwSection(const SwPosition &rPos) : maStart(rPos.nNode),
     mpSection(0), mpTitlePage(0), mpPage(0), meDir(FRMDIR_HORI_LEFT_TOP),
-    nPgWidth(lA4Width), nPgLeft(MM_250), nPgRight(MM_250), mnBorders(0),
-    mbHasFootnote(false)
+    nPgWidth(SvxPaperInfo::GetPaperSize(PAPER_A4).Width()),
+    nPgLeft(MM_250), nPgRight(MM_250), mnBorders(0), mbHasFootnote(false)
 {
 }
 
@@ -1010,11 +1010,10 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
     aNewSection.maSep.dmOrientPage = ReadBSprm(pSep, pIds[0], 0);
 
     // 2. Papiergroesse
-    aNewSection.maSep.xaPage = ReadUSprm(pSep, pIds[1], (USHORT)lLetterWidth);
+    aNewSection.maSep.xaPage = ReadUSprm(pSep, pIds[1], lLetterWidth);
+    aNewSection.nPgWidth = SvxPaperInfo::GetSloppyPaperDimension(aNewSection.maSep.xaPage);
 
-    aNewSection.nPgWidth = SnapPageDimension(aNewSection.maSep.xaPage);
-
-    aNewSection.maSep.yaPage = ReadUSprm(pSep, pIds[2], (USHORT)lLetterHeight);
+    aNewSection.maSep.yaPage = ReadUSprm(pSep, pIds[2], lLetterHeight);
 
     // 3. LR-Raender
     static const USHORT nLef[] = { MM_250, 1800 };
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 88cdb3b..dfc4b27 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -7283,7 +7283,7 @@ SEPr::SEPr() :
     dttmPropRMark(0), dxtCharSpace(0), dyaLinePitch(0), clm(0), reserved1(0),
     dmOrientPage(0), iHeadingPgn(0), pgnStart(1), lnnMin(0), wTextFlow(0),
     reserved2(0), pgbApplyTo(0), pgbPageDepth(0), pgbOffsetFrom(0),
-    xaPage(12240), yaPage(15840), xaPageNUp(12240), yaPageNUp(15840),
+    xaPage(lLetterWidth), yaPage(lLetterHeight), xaPageNUp(lLetterWidth), yaPageNUp(lLetterHeight),
     dxaLeft(1800), dxaRight(1800), dyaTop(1440), dyaBottom(1440), dzaGutter(0),
     dyaHdrTop(720), dyaHdrBottom(720), ccolM1(0), fEvenlySpaced(1),
     reserved3(0), fBiDi(0), fFacingCol(0), fRTLGutter(0), fRTLAlignment(0),
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 8499fff..9d56615 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -1766,6 +1766,11 @@ std::vector<BYTE> ChpxToSprms(const Word2CHPX &rChpx);
 
 ULONG SafeReadString(ByteString &rStr,USHORT nLen,SvStream &rStrm);
 
+//MS has a (slightly) inaccurate view of how many twips
+//are in the default letter size of a page
+const USHORT lLetterWidth = 12242;
+const USHORT lLetterHeight = 15842;
+
 #endif
 
 /* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx
index 19b281d..e300e0d 100644
--- a/sw/source/ui/app/appenv.cxx
+++ b/sw/source/ui/app/appenv.cxx
@@ -395,10 +395,7 @@ static USHORT nTitleNo = 0;
         Size aPaperSize = pPrt->PixelToLogic( pPrt->GetPaperSizePixel(),
                                               MAP_TWIP);
         if ( !aPaperSize.Width() && !aPaperSize.Height() )
-        {
-            aPaperSize.Width() = lA4Width;
-            aPaperSize.Height()= lA4Height;
-        }
+                    aPaperSize = SvxPaperInfo::GetPaperSize(PAPER_A4);
         if ( aPaperSize.Width() > aPaperSize.Height() )
             Swap( aPaperSize );
 
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index 2dc0327..e874e99 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -166,7 +166,7 @@ extern BOOL bDDINetAttr;
 extern BOOL bExecuteDrag;
 
 
-#define OLESIZE	lA4Width - 2 * lMinBorder, 6 * MM50
+#define OLESIZE	11905 - 2 * lMinBorder, 6 * MM50
 
 #define SWTRANSFER_OBJECTTYPE_DRAWMODEL			0x00000001
 #define SWTRANSFER_OBJECTTYPE_HTML              0x00000002
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 763fcb6..d10ceb3 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -179,11 +179,11 @@ SwEnvFmtPage::SwEnvFmtPage(Window* pParent, const SfxItemSet& rSet) :
     aSizeFormatBox     .SetSelectHdl(LINK(this, SwEnvFmtPage, FormatHdl));
 
     // aSizeFormatBox
-    for (USHORT i = SVX_PAPER_A3; i <= SVX_PAPER_KAI32BIG; i++)
+    for (USHORT i = PAPER_A3; i <= PAPER_KAI32BIG; i++)
     {
-        if (i != SVX_PAPER_USER)
+        if (i != PAPER_USER)
         {
-            String aPaperName = SvxPaperInfo::GetName((SvxPaper) i),
+            String aPaperName = SvxPaperInfo::GetName((Paper) i),
                    aEntryName;
 
             USHORT nPos   = 0;
@@ -200,8 +200,8 @@ SwEnvFmtPage::SwEnvFmtPage(Window* pParent, const SfxItemSet& rSet) :
             aIDs.Insert((USHORT) i, nPos);
         }
     }
-    aSizeFormatBox.InsertEntry(SvxPaperInfo::GetName(SVX_PAPER_USER));
-    aIDs.Insert((USHORT) SVX_PAPER_USER, aIDs.Count());
+    aSizeFormatBox.InsertEntry(SvxPaperInfo::GetName(PAPER_USER));
+    aIDs.Insert((USHORT) PAPER_USER, aIDs.Count());
 
 }
 
@@ -228,14 +228,14 @@ IMPL_LINK_INLINE_START( SwEnvFmtPage, ModifyHdl, Edit *, pEdit )
 
     if (pEdit == &aSizeWidthField || pEdit == &aSizeHeightField)
     {
-        SvxPaper ePaper = SvxPaperInfo::GetPaper(
+        Paper ePaper = SvxPaperInfo::GetSvxPaper(
             Size(lHeight, lWidth), MAP_TWIP, TRUE);
         for (USHORT i = 0; i < aIDs.Count(); i++)
             if (aIDs[i] == (USHORT)ePaper)
                 aSizeFormatBox.SelectEntryPos(i);
 
         // Benutzergroesse merken
-        if (aIDs[aSizeFormatBox.GetSelectEntryPos()] == (USHORT)SVX_PAPER_USER)
+        if (aIDs[aSizeFormatBox.GetSelectEntryPos()] == (USHORT)PAPER_USER)
         {
             lUserW = lWidth ;
             lUserH = lHeight;
@@ -470,9 +470,9 @@ IMPL_LINK( SwEnvFmtPage, FormatHdl, ListBox *, EMPTYARG )
     long lAddrFromTop;
 
     USHORT nPaper = aIDs[aSizeFormatBox.GetSelectEntryPos()];
-    if (nPaper != (USHORT)SVX_PAPER_USER)
+    if (nPaper != (USHORT)PAPER_USER)
     {
-        Size aSz = SvxPaperInfo::GetPaperSize((SvxPaper)nPaper);
+        Size aSz = SvxPaperInfo::GetPaperSize((Paper)nPaper);
         lWidth  = Max(aSz.Width(), aSz.Height());
         lHeight = Min(aSz.Width(), aSz.Height());
     }
@@ -581,7 +581,7 @@ void SwEnvFmtPage::FillItem(SwEnvItem& rItem)
     rItem.lSendFromTop  = static_cast< sal_Int32 >(GetFldVal(aSendTopField ));
 
     USHORT nPaper = aIDs[aSizeFormatBox.GetSelectEntryPos()];
-    if (nPaper == (USHORT)SVX_PAPER_USER)
+    if (nPaper == (USHORT)PAPER_USER)
     {
         long lWVal = static_cast< long >(GetFldVal(aSizeWidthField ));
         long lHVal = static_cast< long >(GetFldVal(aSizeHeightField));
@@ -590,8 +590,8 @@ void SwEnvFmtPage::FillItem(SwEnvItem& rItem)
     }
     else
     {
-        long lWVal = SvxPaperInfo::GetPaperSize((SvxPaper)nPaper).Width ();
-        long lHVal = SvxPaperInfo::GetPaperSize((SvxPaper)nPaper).Height();
+        long lWVal = SvxPaperInfo::GetPaperSize((Paper)nPaper).Width ();
+        long lHVal = SvxPaperInfo::GetPaperSize((Paper)nPaper).Height();
         rItem.lWidth  = Max(lWVal, lHVal);
         rItem.lHeight = Min(lWVal, lHVal);
     }
@@ -614,7 +614,7 @@ void __EXPORT SwEnvFmtPage::Reset(const SfxItemSet& rSet)
 {
     const SwEnvItem& rItem = (const SwEnvItem&) rSet.Get(FN_ENVELOP);
 
-    SvxPaper ePaper = SvxPaperInfo::GetPaper(
+    Paper ePaper = SvxPaperInfo::GetSvxPaper(
         Size( Min(rItem.lWidth, rItem.lHeight),
         Max(rItem.lWidth, rItem.lHeight)), MAP_TWIP, TRUE);
     for (USHORT i = 0; i < (USHORT) aIDs.Count(); i++)
diff --git a/sw/source/ui/envelp/envimg.cxx b/sw/source/ui/envelp/envimg.cxx
index ae2d132..c81ef6c 100644
--- a/sw/source/ui/envelp/envimg.cxx
+++ b/sw/source/ui/envelp/envimg.cxx
@@ -119,8 +119,9 @@ SwEnvItem::SwEnvItem() :
     aSendText       = MakeSender();
     lSendFromLeft   = 566; // 1 cm
     lSendFromTop    = 566; // 1 cm
-    lWidth          = lC65Width;
-    lHeight         = lC65Height;
+    Size aEnvSz     = SvxPaperInfo::GetPaperSize(PAPER_ENV_C65);
+    lWidth          = aEnvSz.Width();
+    lHeight         = aEnvSz.Height();
     eAlign          = ENV_HOR_LEFT;
     bPrintFromAbove = TRUE;
     lShiftRight     = 0;
diff --git a/sw/source/ui/frmdlg/colex.cxx b/sw/source/ui/frmdlg/colex.cxx
index 1339948..8b06398 100644
--- a/sw/source/ui/frmdlg/colex.cxx
+++ b/sw/source/ui/frmdlg/colex.cxx
@@ -328,7 +328,7 @@ SwColumnOnlyExample::SwColumnOnlyExample( Window* pParent, const ResId& rResId)
 
     SetBorderStyle( WINDOW_BORDER_MONO );
 
-    m_aFrmSize  = Size(11907, 16433);// DIN A4
+    m_aFrmSize  = SvxPaperInfo::GetPaperSize(PAPER_A4);// DIN A4
     ::FitToActualSize(m_aCols, (USHORT)m_aFrmSize.Width());
 
     long nHeight = m_aFrmSize.Height();
diff --git a/sw/source/ui/inc/colex.hxx b/sw/source/ui/inc/colex.hxx
index 18fbe7c..78b82d8 100644
--- a/sw/source/ui/inc/colex.hxx
+++ b/sw/source/ui/inc/colex.hxx
@@ -31,6 +31,7 @@
 #define _COLEX_HXX
 
 #include <svx/pagectrl.hxx>
+#include <svx/paperinf.hxx>
 #include "swdllapi.h"
 #include <fmtclds.hxx>
 #include "frmatr.hxx"
@@ -46,7 +47,7 @@ class SW_DLLPUBLIC SwPageExample : public SvxPageWindow
 public:
     SwPageExample(Window* pPar, const ResId& rResId ) :
                                 SvxPageWindow(pPar, rResId )
-                                {SetSize(Size(11907, 16433));/*DIN A4*/}
+                                {SetSize(SvxPaperInfo::GetPaperSize(PAPER_A4));/*DIN A4*/}
 
     void UpdateExample( const SfxItemSet& rSet );
 };
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index 2a81df3..024a952 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -384,7 +384,7 @@ SwPreviewPrintOptionsDialog::SwPreviewPrintOptionsDialog( SwPagePreViewWin& rPar
     aSettings.aPrtSize = pPrinter->GetPaperSize();
     //#97682# make sure that no division by zero occurs
     if(!aSettings.aPrtSize.Width() || !aSettings.aPrtSize.Height())
-        aSettings.aPrtSize = Size(lA4Width, lA4Height);
+        aSettings.aPrtSize = SvxPaperInfo::GetPaperSize(PAPER_A4);
     aSettings.bPrinterLandscape = pPrinter->GetOrientation() == ORIENTATION_LANDSCAPE;
 
 
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
index 3c6d793..708372d 100644
--- a/sw/source/ui/uiview/viewport.cxx
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -1278,10 +1278,7 @@ Size SwView::GetOptimalSizePixel() const
 {
     Size aPgSize;
     if ( pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
-    {
-        aPgSize.Height() = lA4Height;
-        aPgSize.Width()  = lA4Width;
-    }
+        aPgSize = SvxPaperInfo::GetPaperSize(PAPER_A4);
     else
     {
         aPgSize = GetWrtShell().GetAnyCurRect(RECT_PAGE).SSize();


More information about the ooo-build-commit mailing list