[Libreoffice-commits] .: 15 commits - basic/source cui/source editeng/CppunitTest_editeng_borderline.mk editeng/Library_editeng.mk editeng/util i18npool/inc i18npool/Library_i18npaper.mk i18npool/Library_i18npool.mk i18npool/Module_i18npool.mk i18npool/Package_inc.mk i18npool/source i18nutil/inc i18nutil/Library_i18nutil.mk i18nutil/Package_inc.mk i18nutil/README i18nutil/source Library_merged.mk reportdesign/source Repository.mk scp2/source sc/source sd/CppunitTest_sd_filters_test.mk sd/Library_sdfilt.mk sd/source sfx2/inc sfx2/source solenv/inc starmath/CppunitTest_starmath_qa_cppunit.mk starmath/Library_sm.mk svtools/source svx/util sw/inc sw/source unusedcode.easy vcl/inc vcl/Library_desktop_detector.mk vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/Library_vclplug_kde4.mk vcl/Library_vclplug_kde.mk vcl/Library_vclplug_svp.mk vcl/source vcl/unx writerfilter/Library_ooxml.mk writerfilter/Library_writerfilter.mk writerfilter/sour ce

Caolán McNamara caolan at kemper.freedesktop.org
Thu Mar 8 04:03:11 PST 2012


 Library_merged.mk                                                 |    1 
 Repository.mk                                                     |    1 
 basic/source/sbx/sbxdec.cxx                                       |   18 
 basic/source/uno/namecont.cxx                                     |   10 
 cui/source/inc/page.hxx                                           |    2 
 cui/source/tabpages/page.h                                        |    4 
 editeng/CppunitTest_editeng_borderline.mk                         |    2 
 editeng/Library_editeng.mk                                        |    2 
 editeng/util/makefile.mk                                          |   98 -
 i18npool/Library_i18npaper.mk                                     |   57 -
 i18npool/Library_i18npool.mk                                      |    2 
 i18npool/Module_i18npool.mk                                       |    1 
 i18npool/Package_inc.mk                                           |    1 
 i18npool/inc/i18npool/paper.hxx                                   |  157 ---
 i18npool/inc/scripttypedetector.hxx                               |   69 -
 i18npool/inc/unoscripttypedetector.hxx                            |   66 +
 i18npool/source/characterclassification/scripttypedetector.cxx    |  182 ---
 i18npool/source/characterclassification/unoscripttypedetector.cxx |   97 +
 i18npool/source/paper/paper.cxx                                   |  522 ----------
 i18npool/source/registerservices/registerservices.cxx             |    6 
 i18nutil/Library_i18nutil.mk                                      |    2 
 i18nutil/Package_inc.mk                                           |    2 
 i18nutil/README                                                   |    4 
 i18nutil/inc/i18nutil/oneToOneMapping.hxx                         |    7 
 i18nutil/inc/i18nutil/paper.hxx                                   |  155 ++
 i18nutil/inc/i18nutil/scripttypedetector.hxx                      |   47 
 i18nutil/inc/i18nutil/x_rtl_ustring.h                             |   64 -
 i18nutil/source/utility/paper.cxx                                 |  522 ++++++++++
 i18nutil/source/utility/scripttypedetector.cxx                    |  141 ++
 reportdesign/source/ui/dlg/GroupsSorting.cxx                      |   15 
 sc/source/ui/vba/vbapagesetup.cxx                                 |    2 
 scp2/source/ooo/file_library_ooo.scp                              |    2 
 scp2/source/ooo/module_hidden_ooo.scp                             |    1 
 sd/CppunitTest_sd_filters_test.mk                                 |    1 
 sd/Library_sdfilt.mk                                              |    1 
 sd/source/filter/eppt/epptbase.hxx                                |    2 
 sd/source/filter/eppt/pptx-text.cxx                               |   26 
 sfx2/inc/sfx2/tbxctrl.hxx                                         |    2 
 sfx2/source/toolbox/tbxitem.cxx                                   |    7 
 solenv/inc/libs.mk                                                |    4 
 starmath/CppunitTest_starmath_qa_cppunit.mk                       |    2 
 starmath/Library_sm.mk                                            |    2 
 svtools/source/filter/wmf/winwmf.cxx                              |    5 
 svx/util/makefile.mk                                              |  197 ---
 sw/inc/authfld.hxx                                                |    2 
 sw/inc/breakit.hxx                                                |   27 
 sw/inc/dbfld.hxx                                                  |   32 
 sw/inc/dbmgr.hxx                                                  |    4 
 sw/inc/ddefld.hxx                                                 |   10 
 sw/inc/doc.hxx                                                    |    2 
 sw/inc/docufld.hxx                                                |   94 -
 sw/inc/editsh.hxx                                                 |    2 
 sw/inc/expfld.hxx                                                 |   46 
 sw/inc/fldbas.hxx                                                 |   10 
 sw/inc/flddat.hxx                                                 |    4 
 sw/inc/flddropdown.hxx                                            |   36 
 sw/inc/fmtrfmrk.hxx                                               |    6 
 sw/inc/inetfld.hxx                                                |    8 
 sw/inc/reffld.hxx                                                 |   10 
 sw/inc/usrfld.hxx                                                 |   10 
 sw/source/core/bastyp/breakit.cxx                                 |   43 
 sw/source/core/bastyp/calc.cxx                                    |    2 
 sw/source/core/doc/doc.cxx                                        |    2 
 sw/source/core/doc/docfld.cxx                                     |   17 
 sw/source/core/doc/doclay.cxx                                     |    4 
 sw/source/core/edit/editsh.cxx                                    |    2 
 sw/source/core/fields/authfld.cxx                                 |    2 
 sw/source/core/fields/dbfld.cxx                                   |   40 
 sw/source/core/fields/ddefld.cxx                                  |   12 
 sw/source/core/fields/docufld.cxx                                 |  106 +-
 sw/source/core/fields/expfld.cxx                                  |   26 
 sw/source/core/fields/fldbas.cxx                                  |   21 
 sw/source/core/fields/flddat.cxx                                  |   11 
 sw/source/core/fields/flddropdown.cxx                             |   61 -
 sw/source/core/fields/macrofld.cxx                                |   46 
 sw/source/core/fields/reffld.cxx                                  |   12 
 sw/source/core/fields/scrptfld.cxx                                |   12 
 sw/source/core/fields/tblcalc.cxx                                 |    4 
 sw/source/core/fields/usrfld.cxx                                  |   10 
 sw/source/core/text/porlay.cxx                                    |   11 
 sw/source/core/unocore/unocoll.cxx                                |    2 
 sw/source/core/unocore/unofield.cxx                               |    2 
 sw/source/filter/html/htmlfldw.cxx                                |    4 
 sw/source/filter/ww8/wrtww8.hxx                                   |   13 
 sw/source/filter/ww8/wrtww8gr.cxx                                 |   13 
 sw/source/filter/ww8/ww8atr.cxx                                   |    8 
 sw/source/filter/ww8/ww8par.cxx                                   |    4 
 sw/source/filter/ww8/ww8par.hxx                                   |   22 
 sw/source/filter/ww8/ww8par3.cxx                                  |   20 
 sw/source/filter/ww8/ww8scan.cxx                                  |    4 
 sw/source/filter/ww8/ww8scan.hxx                                  |    2 
 sw/source/ui/config/optload.cxx                                   |    6 
 sw/source/ui/dbui/dbmgr.cxx                                       |    8 
 sw/source/ui/fldui/DropDownFieldDialog.cxx                        |    2 
 sw/source/ui/fldui/flddinf.cxx                                    |    2 
 sw/source/ui/fldui/flddok.cxx                                     |    4 
 sw/source/ui/fldui/fldfunc.cxx                                    |    6 
 sw/source/ui/fldui/fldmgr.cxx                                     |    2 
 sw/source/ui/fldui/fldref.cxx                                     |    2 
 sw/source/ui/fldui/fldvar.cxx                                     |    4 
 sw/source/ui/fldui/inpdlg.cxx                                     |    8 
 sw/source/ui/fldui/javaedit.cxx                                   |    6 
 sw/source/ui/frmdlg/cption.cxx                                    |    7 
 sw/source/ui/inc/fldmgr.hxx                                       |    2 
 sw/source/ui/inc/javaedit.hxx                                     |    8 
 sw/source/ui/shells/textfld.cxx                                   |    2 
 sw/source/ui/utlui/content.cxx                                    |    4 
 unusedcode.easy                                                   |    5 
 vcl/Library_desktop_detector.mk                                   |    1 
 vcl/Library_vcl.mk                                                |    1 
 vcl/Library_vclplug_gen.mk                                        |    1 
 vcl/Library_vclplug_gtk.mk                                        |    1 
 vcl/Library_vclplug_gtk3.mk                                       |    1 
 vcl/Library_vclplug_kde.mk                                        |    1 
 vcl/Library_vclplug_kde4.mk                                       |    1 
 vcl/Library_vclplug_svp.mk                                        |    1 
 vcl/inc/vcl/prntypes.hxx                                          |    2 
 vcl/inc/vcl/window.hxx                                            |    5 
 vcl/source/control/ctrl.cxx                                       |    1 
 vcl/unx/generic/printer/printerinfomanager.cxx                    |    2 
 writerfilter/Library_ooxml.mk                                     |    2 
 writerfilter/Library_writerfilter.mk                              |    2 
 writerfilter/source/dmapper/DomainMapper.cxx                      |    2 
 writerfilter/source/dmapper/PropertyMap.cxx                       |    2 
 124 files changed, 1538 insertions(+), 1918 deletions(-)

New commits:
commit 7ab0fad5664d93cbdba907c59099c15f2278d204
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 8 11:40:10 2012 +0000

    need to remove i18npaper from install lib list

diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index 0ab4566..fe08906 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -692,8 +692,6 @@ File gid_File_Lib_I18nutil
     Styles = (PACKED);
 End
 
-STD_LIB_FILE( gid_File_Lib_I18npaper, i18npaper)
-
 #ifndef SYSTEM_ICU
 
 File gid_File_Lib_Icudata
diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp
index 2bf6931..e28e5aa 100644
--- a/scp2/source/ooo/module_hidden_ooo.scp
+++ b/scp2/source/ooo/module_hidden_ooo.scp
@@ -356,7 +356,6 @@ Module gid_Module_Root_Files_5
 	gid_File_Lib_Filterconfig1,
 	gid_File_Lib_Dbodbcbase,
 	gid_File_Lib_I18npool,
-	gid_File_Lib_I18npaper,
 	gid_File_Lib_I18nregexp,
 	gid_File_Lib_I18nsearch,
     gid_File_Lib_I18nisolang,
commit e4fe6a9c464ff4637696cae333524907ee881a6e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 8 10:53:31 2012 +0000

    state *what* was not found when throwing exception

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index f6544b5..a9307d2 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -246,7 +246,10 @@ void NameContainer::removeByName( const OUString& aName )
     NameContainerNameMap::iterator aIt = mHashMap.find( aName );
     if( aIt == mHashMap.end() )
     {
-        throw NoSuchElementException();
+        rtl::OUString sMessage = rtl::OUStringBuffer().append('"')
+            .append(aName).append("\" not found")
+            .makeStringAndClear();
+        throw NoSuchElementException(sMessage, uno::Reference< uno::XInterface >());
     }
 
     sal_Int32 iHashResult = (*aIt).second;
@@ -1170,16 +1173,15 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
                 mxSFI->kill( aPrevFolder );
             }
         }
-        catch(const Exception& )
+        catch(const Exception& e)
         {
             bCleanUp = true;
+            SAL_WARN("basic", "Upgrade of Basic installation failed somehow: " << e.Message);
         }
 
         // #i93163
         if( bCleanUp )
         {
-            SAL_WARN("basic", "Upgrade of Basic installation failed somehow");
-
             static const char strErrorSavFolderName[] = "__basic_80_err";
             INetURLObject aPrevUserBasicInetObj_Err( aUserBasicInetObj );
             aPrevUserBasicInetObj_Err.removeSegment();
commit 6a7a5740ad82f2ada6dded286aacc32f2af1b246
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 8 09:43:26 2012 +0000

    64bit Truncated pointer used as an unique 32bit id

diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 1142252..a7dd47a 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -117,7 +117,10 @@ class WW8_WrtBookmarks;
 class WW8_WrtRedlineAuthor;
 class SvxMSExportOLEObjects;
 class SwMSConvertControls;
-typedef std::set<sal_uInt32> WW8OleSet;
+namespace com { namespace sun { namespace star { namespace embed {
+class XEmbeddedObject;
+} } } }
+typedef std::map<const com::sun::star::embed::XEmbeddedObject*, sal_Int32> WW8OleMap;
 class SvStorageRef;
 struct WW8_PdAttrDesc;
 class SvxBrushItem;
@@ -461,7 +464,7 @@ public:
     boost::shared_ptr<NfKeywordTable> pKeyMap;
     SvxMSExportOLEObjects* pOLEExp;
     SwMSConvertControls* pOCXExp;
-    WW8OleSet m_aOleSet;    // To remember all already exported ole objects
+    WW8OleMap m_aOleMap;    // To remember all already exported ole objects
     ww8::WW8TableInfo::Pointer_t mpTableInfo;
 
     sal_uInt16 nCharFmtStart;
@@ -968,7 +971,7 @@ public:
 
     SvxMSExportOLEObjects& GetOLEExp()      { return *pOLEExp; }
     SwMSConvertControls& GetOCXExp()        { return *pOCXExp; }
-    WW8OleSet& GetOLESet()                  { return m_aOleSet; }
+    WW8OleMap& GetOLEMap()                  { return m_aOleMap; }
     void ExportDopTypography(WW8DopTypography &rTypo);
 
     sal_uInt16 AddRedlineAuthor( sal_uInt16 nId );
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index f8614f9..c0008d7 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -242,9 +242,16 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
         if( xObj.is() )
         {
             const embed::XEmbeddedObject *pObj = xObj.get();
-            sal_uInt32 nPictureId = (sal_uInt32)(sal_uIntPtr)pObj;
-            //.second is false when element already existed
-            bool bIsNotDuplicate = GetOLESet().insert(nPictureId).second;
+            WW8OleMap& rPointerToObjId = GetOLEMap();
+            //Don't want to use pointer ids, as is traditional, because we need
+            //to put this into a 32bit value, and on 64bit the bottom bits
+            //might collide and two unrelated ole objects end up considered the
+            //same.  Don't want to simply start at 0 which is a special value
+            sal_Int32 nPictureId = SAL_MAX_INT32 - rPointerToObjId.size();
+            WW8OleMap::value_type entry = std::make_pair(pObj, nPictureId);
+            std::pair<WW8OleMap::iterator, bool> aRes = rPointerToObjId.insert(entry);
+            bool bIsNotDuplicate = aRes.second; //.second is false when element already existed
+            nPictureId = aRes.first->second;
             Set_UInt32(pDataAdr, nPictureId);
             String sStorageName( '_' );
             sStorageName += String::CreateFromInt32( nPictureId );
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 4e57ac6..9b79d23 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5591,7 +5591,7 @@ sal_Bool SwMSDffManager::GetOLEStorageName(long nOLEId, String& rStorageName,
 {
     bool bRet = false;
 
-    long nPictureId = 0;
+    sal_Int32 nPictureId = 0;
     if (rReader.pStg)
     {
         // dann holen wir uns mal ueber den TextBox-PLCF die richtigen
commit 0c816004eac48a7ac5d571fdf9a46db9fc497958
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 8 09:04:14 2012 +0000

    tidy up SwBreakIt

diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx
index 93186f5..5fa2bd5 100644
--- a/sw/inc/breakit.hxx
+++ b/sw/inc/breakit.hxx
@@ -29,23 +29,21 @@
 #ifndef _BREAKIT_HXX
 #define _BREAKIT_HXX
 
-#include <tools/solar.h>
-#include <i18npool/lang.h>
+#include <boost/noncopyable.hpp>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/i18n/XBreakIterator.hpp>
 #include <com/sun/star/i18n/XScriptTypeDetector.hpp>
 #include <com/sun/star/i18n/ForbiddenCharacters.hdl>
+#include <i18npool/lang.h>
 #include <swdllapi.h>
 
-class String;
-
 /*************************************************************************
  *                      class SwBreakIt
  *************************************************************************/
 
 
-class SW_DLLPUBLIC SwBreakIt
+class SW_DLLPUBLIC SwBreakIt : private ::boost::noncopyable
 {
     com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF;
     mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xBreak;
@@ -61,11 +59,6 @@ class SW_DLLPUBLIC SwBreakIt
 
     void createBreakIterator() const;
 
-    // forbidden and not implemented.
-    SwBreakIt();
-    SwBreakIt( const SwBreakIt &);
-    SwBreakIt & operator= ( const SwBreakIt &);
-
     // private (see @ _Create, _Delete).
     explicit SwBreakIt(
         const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rxMSF);
@@ -100,8 +93,8 @@ public:
         return *m_pForbidden;
     }
 
-    sal_uInt16 GetRealScriptOfText( const String& rTxt, xub_StrLen nPos ) const;
-    sal_uInt16 GetAllScriptsOfText( const String& rTxt ) const;
+    sal_uInt16 GetRealScriptOfText( const rtl::OUString& rTxt, sal_Int32 nPos ) const;
+    sal_uInt16 GetAllScriptsOfText( const rtl::OUString& rTxt ) const;
 
     sal_Int32 getGraphemeCount(const rtl::OUString& rStr) const;
 };
diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
index 9b4476f..313fdca 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -97,34 +97,34 @@ void SwBreakIt::_GetForbidden( const LanguageType aLang )
     m_pForbidden = new i18n::ForbiddenCharacters( aWrap.getForbiddenCharacters() );
 }
 
-sal_uInt16 SwBreakIt::GetRealScriptOfText( const String& rTxt,
-                                        xub_StrLen nPos ) const
+sal_uInt16 SwBreakIt::GetRealScriptOfText( const rtl::OUString& rTxt, sal_Int32 nPos ) const
 {
     createBreakIterator();
     sal_uInt16 nScript = i18n::ScriptType::WEAK;
-    if( xBreak.is() && rTxt.Len() )
+    if( xBreak.is() && !rTxt.isEmpty() )
     {
-        if( nPos && nPos == rTxt.Len() )
+        if( nPos && nPos == rTxt.getLength() )
             --nPos;
         nScript = xBreak->getScriptType( rTxt, nPos );
         sal_Int32 nChgPos = 0;
-        if ( i18n::ScriptType::WEAK == nScript && nPos + 1 < rTxt.Len() )
+        if ( i18n::ScriptType::WEAK == nScript && nPos + 1 < rTxt.getLength() )
         {
             // A weak character followed by a mark may be meant to combine with
             // the mark, so prefer the following character's script
-            switch ( u_charType(rTxt.GetChar(nPos + 1) ) ) {
-            case U_NON_SPACING_MARK:
-            case U_ENCLOSING_MARK:
-            case U_COMBINING_SPACING_MARK:
-                nScript = xBreak->getScriptType( rTxt, nPos+1 );
-                break;
+            switch (u_charType(rTxt[nPos + 1]))
+            {
+                case U_NON_SPACING_MARK:
+                case U_ENCLOSING_MARK:
+                case U_COMBINING_SPACING_MARK:
+                    nScript = xBreak->getScriptType( rTxt, nPos+1 );
+                    break;
             }
         }
         if( i18n::ScriptType::WEAK == nScript && nPos &&
             0 < (nChgPos = xBreak->beginOfScript( rTxt, nPos, nScript )) )
             nScript = xBreak->getScriptType( rTxt, nChgPos-1 );
 
-        if( i18n::ScriptType::WEAK == nScript && rTxt.Len() >
+        if( i18n::ScriptType::WEAK == nScript && rTxt.getLength() >
             ( nChgPos = xBreak->endOfScript( rTxt, nPos, nScript ) ) &&
             0 <= nChgPos )
             nScript = xBreak->getScriptType( rTxt, nChgPos );
@@ -134,7 +134,7 @@ sal_uInt16 SwBreakIt::GetRealScriptOfText( const String& rTxt,
     return nScript;
 }
 
-sal_uInt16 SwBreakIt::GetAllScriptsOfText( const String& rTxt ) const
+sal_uInt16 SwBreakIt::GetAllScriptsOfText( const rtl::OUString& rTxt ) const
 {
     const sal_uInt16 coAllScripts = ( SCRIPTTYPE_LATIN |
                                   SCRIPTTYPE_ASIAN |
@@ -143,15 +143,15 @@ sal_uInt16 SwBreakIt::GetAllScriptsOfText( const String& rTxt ) const
     sal_uInt16 nRet = 0, nScript;
     if( !xBreak.is() )
         nRet = coAllScripts;
-    else if( rTxt.Len() )
+    else if( !rTxt.isEmpty() )
     {
-        for( xub_StrLen n = 0, nEnd = rTxt.Len(); n < nEnd;
-                n = static_cast<xub_StrLen>(xBreak->endOfScript( rTxt, n, nScript )) )
+        for( sal_Int32 n = 0, nEnd = rTxt.getLength(); n < nEnd;
+                n = xBreak->endOfScript(rTxt, n, nScript) )
         {
             switch( nScript = xBreak->getScriptType( rTxt, n ) )
             {
-            case i18n::ScriptType::LATIN:       nRet |= SCRIPTTYPE_LATIN;   break;
-            case i18n::ScriptType::ASIAN:       nRet |= SCRIPTTYPE_ASIAN;   break;
+            case i18n::ScriptType::LATIN:   nRet |= SCRIPTTYPE_LATIN;   break;
+            case i18n::ScriptType::ASIAN:   nRet |= SCRIPTTYPE_ASIAN;   break;
             case i18n::ScriptType::COMPLEX: nRet |= SCRIPTTYPE_COMPLEX; break;
             case i18n::ScriptType::WEAK:
                     if( !nRet )
commit 80b0a3a7b647b3d60379344a37a5f9b15a2bbfe9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 8 00:40:31 2012 +0000

    fold i18npaper into i18nutil
    
    It's too small to justify standalone existence.
    
    We can accumulate i18n things we link to directly into
    i18nutil and rework i18npool uno implementions in terms
    of thin wrappers over i18nutil and prefer linking to
    i18nutil internally and leave the uno forwarders for
    use by external components and scripting

diff --git a/Library_merged.mk b/Library_merged.mk
index 72be071..cbd016b 100644
--- a/Library_merged.mk
+++ b/Library_merged.mk
@@ -29,7 +29,6 @@ $(eval $(call gb_Library_add_linked_libs,merged,\
 	cppu \
 	cppuhelper \
 	i18nisolang1 \
-	i18npaper \
     i18nutil \
     jvmfwk \
 	sal \
diff --git a/Repository.mk b/Repository.mk
index cdc26da..72c2f5c 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -221,7 +221,6 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \
     helplinker \
     hwp \
     hyphen \
-    i18npaper \
     i18nregexp \
     icd \
     icg \
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index b1111ce..da59f29 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -38,7 +38,7 @@
 #include <svx/pagectrl.hxx>
 #include <svx/frmdirlbox.hxx>
 #include <editeng/svxenum.hxx>
-#include <i18npool/paper.hxx>
+#include <i18nutil/paper.hxx>
 #include <svx/flagsdef.hxx>
 
 // class SvxPageDescPage -------------------------------------------------
diff --git a/cui/source/tabpages/page.h b/cui/source/tabpages/page.h
index 6d5821f..c394eb1 100644
--- a/cui/source/tabpages/page.h
+++ b/cui/source/tabpages/page.h
@@ -31,8 +31,8 @@
 // define ----------------------------------------------------------------
 
 //!! the values of the following defines must correspond to the array position
-//!! of the respective paper size in the file i18npool/source/paper/paper.cxx
-//!! There are enums for them in i18npool/inc/i18npool/paper.hxx but unfortunately
+//!! of the respective paper size in the file i18nutil/source/utility/paper.cxx
+//!! There are enums for them in i18npool/inc/i18nutil/paper.hxx but unfortunately
 //!! the resource compiler does not understand enums, thus the enum values need
 //!! to be duplicated here for use in the src file.
 #define PAPERSIZE_A0            0
diff --git a/editeng/CppunitTest_editeng_borderline.mk b/editeng/CppunitTest_editeng_borderline.mk
index e42cae5..9edbdb0 100644
--- a/editeng/CppunitTest_editeng_borderline.mk
+++ b/editeng/CppunitTest_editeng_borderline.mk
@@ -51,7 +51,7 @@ $(eval $(call gb_CppunitTest_add_linked_libs,editeng_borderline, \
     sal \
     salhelper \
     i18nisolang1 \
-    i18npaper \
+    i18nutil \
     $(gb_STDLIBS) \
 ))
 
diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk
index 5075872..c0c5544 100644
--- a/editeng/Library_editeng.mk
+++ b/editeng/Library_editeng.mk
@@ -151,7 +151,7 @@ $(eval $(call gb_Library_add_linked_libs,editeng,\
     sal \
     salhelper \
     i18nisolang1 \
-    i18npaper \
+    i18nutil \
     $(gb_STDLIBS) \
 ))
 
diff --git a/i18npool/Library_i18npaper.mk b/i18npool/Library_i18npaper.mk
deleted file mode 100644
index 88813ab..0000000
--- a/i18npool/Library_i18npaper.mk
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Initial Developer of the Original Code is
-#       Matúš Kukan <matus.kukan at gmail.com>
-# Portions created by the Initial Developer are Copyright (C) 2011 the
-# Initial Developer. All Rights Reserved.
-#
-# Major Contributor(s):
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_Library_Library,i18npaper))
-
-$(eval $(call gb_Library_add_package_headers,i18npaper,i18npool_inc))
-
-$(eval $(call gb_Library_set_include,i18npaper,\
-	$$(INCLUDE) \
-))
-
-$(eval $(call gb_Library_add_api,i18npaper,\
-	udkapi \
-	offapi \
-))
-
-$(eval $(call gb_Library_add_defs,i18npaper,\
-	-DI18NPAPER_DLLIMPLEMENTATION \
-))
-
-$(eval $(call gb_Library_add_linked_libs,i18npaper,\
-	comphelper \
-	cppu \
-	sal \
-	$(gb_STDLIBS) \
-))
-
-$(eval $(call gb_Library_add_exception_objects,i18npaper,\
-	i18npool/source/paper/paper \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/i18npool/Module_i18npool.mk b/i18npool/Module_i18npool.mk
index 3cd75e3..3a90cef 100644
--- a/i18npool/Module_i18npool.mk
+++ b/i18npool/Module_i18npool.mk
@@ -33,7 +33,6 @@ $(eval $(call gb_Module_add_targets,i18npool,\
 	Library_dict_ja \
 	Library_dict_zh \
 	Library_i18nisolang1 \
-	Library_i18npaper \
 	Library_i18npool \
 	Library_i18nsearch \
 	Library_index_data \
diff --git a/i18npool/Package_inc.mk b/i18npool/Package_inc.mk
index 7d7fec1..9fd2f20 100644
--- a/i18npool/Package_inc.mk
+++ b/i18npool/Package_inc.mk
@@ -33,6 +33,5 @@ $(eval $(call gb_Package_add_file,i18npool_inc,inc/i18npool/version.mk,../versio
 $(eval $(call gb_Package_add_file,i18npool_inc,inc/i18npool/i18npooldllapi.h,i18npool/i18npooldllapi.h))
 $(eval $(call gb_Package_add_file,i18npool_inc,inc/i18npool/lang.h,i18npool/lang.h))
 $(eval $(call gb_Package_add_file,i18npool_inc,inc/i18npool/mslangid.hxx,i18npool/mslangid.hxx))
-$(eval $(call gb_Package_add_file,i18npool_inc,inc/i18npool/paper.hxx,i18npool/paper.hxx))
 
 # vim: set noet sw=4 ts=4:
diff --git a/i18npool/inc/i18npool/paper.hxx b/i18npool/inc/i18npool/paper.hxx
deleted file mode 100644
index ed8396e..0000000
--- a/i18npool/inc/i18npool/paper.hxx
+++ /dev/null
@@ -1,157 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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 INCLUDED_I18NPOOL_PAPER_HXX
-#define INCLUDED_I18NPOOL_PAPER_HXX
-
-#include <sal/config.h>
-
-#include "i18npool/i18npooldllapi.h"
-#include <rtl/string.hxx>
-#include <com/sun/star/lang/Locale.hpp>
-
-//!! WARNING: be aware of cui/source/tabpages/page.h where someone had the broken idea
-//!! of duplicating the values of this enum in order to use those defines within
-//!! src files.
-//!! Thus don't reorder the enum values here without changing the code there as well.
-enum Paper
-{
-    PAPER_A0,
-    PAPER_A1,
-    PAPER_A2,
-    PAPER_A3,
-    PAPER_A4,
-    PAPER_A5,
-    PAPER_B4_ISO,
-    PAPER_B5_ISO,
-    PAPER_LETTER,
-    PAPER_LEGAL,
-    PAPER_TABLOID,
-    PAPER_USER,
-    PAPER_B6_ISO,
-    PAPER_ENV_C4,
-    PAPER_ENV_C5,
-    PAPER_ENV_C6,
-    PAPER_ENV_C65,
-    PAPER_ENV_DL,
-    PAPER_SLIDE_DIA,
-    PAPER_SCREEN,
-    PAPER_C,
-    PAPER_D,
-    PAPER_E,
-    PAPER_EXECUTIVE,
-    PAPER_FANFOLD_LEGAL_DE,
-    PAPER_ENV_MONARCH,
-    PAPER_ENV_PERSONAL,
-    PAPER_ENV_9,
-    PAPER_ENV_10,
-    PAPER_ENV_11,
-    PAPER_ENV_12,
-    PAPER_KAI16,
-    PAPER_KAI32,
-    PAPER_KAI32BIG,
-    PAPER_B4_JIS,
-    PAPER_B5_JIS,
-    PAPER_B6_JIS,
-    PAPER_LEDGER,
-    PAPER_STATEMENT,
-    PAPER_QUARTO,
-    PAPER_10x14,
-    PAPER_ENV_14,
-    PAPER_ENV_C3,
-    PAPER_ENV_ITALY,
-    PAPER_FANFOLD_US,
-    PAPER_FANFOLD_DE,
-    PAPER_POSTCARD_JP,
-    PAPER_9x11,
-    PAPER_10x11,
-    PAPER_15x11,
-    PAPER_ENV_INVITE,
-    PAPER_A_PLUS,
-    PAPER_B_PLUS,
-    PAPER_LETTER_PLUS,
-    PAPER_A4_PLUS,
-    PAPER_DOUBLEPOSTCARD_JP,
-    PAPER_A6,
-    PAPER_12x11,
-    PAPER_A7,
-    PAPER_A8,
-    PAPER_A9,
-    PAPER_A10,
-    PAPER_B0_ISO,
-    PAPER_B1_ISO,
-    PAPER_B2_ISO,
-    PAPER_B3_ISO,
-    PAPER_B7_ISO,
-    PAPER_B8_ISO,
-    PAPER_B9_ISO,
-    PAPER_B10_ISO,
-    PAPER_ENV_C2,
-    PAPER_ENV_C7,
-    PAPER_ENV_C8,
-    PAPER_ARCHA,
-    PAPER_ARCHB,
-    PAPER_ARCHC,
-    PAPER_ARCHD,
-    PAPER_ARCHE
-};
-
-// defined for 'equal size' test with the implementation array
-#define NUM_PAPER_ENTRIES   (PAPER_ARCHE - PAPER_A0 + 1)
-
-// ---------
-// - Paper -
-// ---------
-
-class I18NPAPER_DLLPUBLIC PaperInfo
-{
-    Paper m_eType;
-    long m_nPaperWidth;     // width in 100thMM
-    long m_nPaperHeight;    // height in 100thMM
-public:
-    PaperInfo(Paper eType);
-    PaperInfo(long nPaperWidth, long nPaperHeight);
-
-    Paper getPaper() const { return m_eType; }
-    long getWidth() const { return m_nPaperWidth; }
-    long getHeight() const { return m_nPaperHeight; }
-    bool sloppyEqual(const PaperInfo &rOther) const;
-    bool doSloppyFit();
-
-    static PaperInfo getSystemDefaultPaper();
-    static PaperInfo getDefaultPaperForLocale(const ::com::sun::star::lang::Locale & rLocale);
-
-    static Paper fromPSName(const rtl::OString &rName);
-    static rtl::OString toPSName(Paper eType);
-
-    static long sloppyFitPageDimension(long nDimension);
-};
-
-#endif // INCLUDED_I18NPOOL_PAPER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/i18npool/source/paper/paper.cxx b/i18npool/source/paper/paper.cxx
deleted file mode 100644
index d9e2f47..0000000
--- a/i18npool/source/paper/paper.cxx
+++ /dev/null
@@ -1,522 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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.
- *
- ************************************************************************/
-
-
-#include <osl/diagnose.h>
-#include <sal/config.h>
-#include <sal/macros.h>
-#include <rtl/ustring.hxx>
-#include <rtl/string.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-
-#include "i18npool/paper.hxx"
-
-#include <utility>
-#include <cstdlib>
-
-#ifdef UNX
-#include <stdio.h>
-#include <string.h>
-#include <locale.h>
-#if defined(LC_PAPER) && defined(_GNU_SOURCE)
-#include <langinfo.h>
-#endif
-#endif
-
-struct PageDesc
-{
-    long m_nWidth;
-    long m_nHeight;
-    const char *m_pPSName;
-    const char *m_pAltPSName;
-};
-
-#define PT2MM100( v ) \
-    (long)(((v) * 35.27777778) + 0.5)
-
-#define IN2MM100( v ) \
-    ((long)(((v) * 2540) + 0.5))
-
-#define MM2MM100( v ) \
-    ((long)((v) * 100))
-
-//PostScript Printer Description File Format Specification
-//http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
-//http://www.y-adagio.com/public/committees/docsii/doc_00-49/symp_ulaan/china_ppr.pdf (Kai)
-//http://www.sls.psi.ch/controls/help/howto/Howto_Print_a_A0_Poster_at_WSLA_012_2.pdf (Dia)
-static PageDesc aDinTab[] =
-{
-    { MM2MM100( 841 ),   MM2MM100( 1189 ),   "A0",  NULL },
-    { MM2MM100( 594 ),   MM2MM100( 841 ),    "A1",  NULL },
-    { MM2MM100( 420 ),   MM2MM100( 594 ),    "A2",  NULL },
-    { MM2MM100( 297 ),   MM2MM100( 420 ),    "A3",  NULL },
-    { MM2MM100( 210 ),   MM2MM100( 297 ),    "A4",  NULL },
-    { MM2MM100( 148 ),   MM2MM100( 210 ),    "A5",  NULL },
-    { MM2MM100( 250 ),   MM2MM100( 353 ),    "ISOB4",  NULL },
-    { MM2MM100( 176 ),   MM2MM100( 250 ),    "ISOB5",  NULL },
-    { IN2MM100( 8.5 ),   IN2MM100( 11 ),     "Letter",  "Note" },
-    { IN2MM100( 8.5 ),   IN2MM100( 14 ),     "Legal",  NULL },
-    { IN2MM100( 11 ),    IN2MM100( 17 ),     "Tabloid",  "11x17" },
-    { 0,                 0,                  NULL, NULL }, //User
-    { MM2MM100( 125 ),   MM2MM100( 176 ),    "ISOB6",  NULL },
-    { MM2MM100( 229 ),   MM2MM100( 324 ),    "EnvC4",  "C4" },
-    { MM2MM100( 162 ),   MM2MM100( 229 ),    "EnvC5",  "C5" },
-    { MM2MM100( 114 ),   MM2MM100( 162 ),    "EnvC6",  "C6" },
-    { MM2MM100( 114 ),   MM2MM100( 229 ),    "EnvC65", NULL },
-    { MM2MM100( 110 ),   MM2MM100( 220 ),    "EnvDL",  "DL" },
-    { MM2MM100( 180),    MM2MM100( 270 ),    NULL,  NULL }, //Dia
-    { MM2MM100( 210),    MM2MM100( 280 ),    NULL,  NULL }, //Screen
-    { IN2MM100( 17 ),    IN2MM100( 22 ),     "AnsiC",  "CSheet" },
-    { IN2MM100( 22 ),    IN2MM100( 34 ),     "AnsiD",  "DSheet" },
-    { IN2MM100( 34 ),    IN2MM100( 44 ),     "AnsiE",  "ESheet" },
-    { IN2MM100( 7.25 ),  IN2MM100( 10.5 ),   "Executive",  NULL },
-    //"Folio" is a different size in the PPD documentation than 8.5x11
-    //This "FanFoldGermanLegal" is known in the Philippines as
-    //"Legal" paper or "Long Bond Paper".  The "Legal" name causing untold
-    //misery, given the differently sized US "Legal" paper
-    { IN2MM100( 8.5 ),   IN2MM100( 13 ),     "FanFoldGermanLegal",  NULL },
-    { IN2MM100( 3.875 ), IN2MM100( 7.5 ),    "EnvMonarch", "Monarch" },
-    { IN2MM100( 3.625 ), IN2MM100( 6.5 ),    "EnvPersonal",  "Personal" },
-    { IN2MM100( 3.875 ), IN2MM100( 8.875 ),  "Env9",  NULL },
-    { IN2MM100( 4.125 ), IN2MM100( 9.5 ),    "Env10",  "Comm10" },
-    { IN2MM100( 4.5 ),   IN2MM100( 10.375 ), "Env11",  NULL },
-    { IN2MM100( 4.75 ),  IN2MM100( 11 ),     "Env12",  NULL },
-    { MM2MM100( 184 ),   MM2MM100( 260 ),    NULL,  NULL }, //Kai16
-    { MM2MM100( 130 ),   MM2MM100( 184 ),    NULL,  NULL }, //Kai32
-    { MM2MM100( 140 ),   MM2MM100( 203 ),    NULL,  NULL }, //BigKai32
-    { MM2MM100( 257 ),   MM2MM100( 364 ),    "B4",  NULL }, //JIS
-    { MM2MM100( 182 ),   MM2MM100( 257 ),    "B5",  NULL }, //JIS
-    { MM2MM100( 128 ),   MM2MM100( 182 ),    "B6",  NULL }, //JIS
-    { IN2MM100( 17 ),    IN2MM100( 11 ),     "Ledger",  NULL },
-    { IN2MM100( 5.5 ),   IN2MM100( 8.5 ),    "Statement",  NULL },
-    { PT2MM100( 610 ),   PT2MM100( 780 ),    "Quarto",  NULL },
-    { IN2MM100( 10 ),    IN2MM100( 14 ),     "10x14",  NULL },
-    { IN2MM100( 5.5 ),   IN2MM100( 11.5 ),   "Env14",  NULL },
-    { MM2MM100( 324 ),   MM2MM100( 458 ),    "EnvC3",  "C3" },
-    { MM2MM100( 110 ),   MM2MM100( 230 ),    "EnvItalian",  NULL },
-    { IN2MM100( 14.875 ),IN2MM100( 11 ),     "FanFoldUS",  NULL },
-    { IN2MM100( 8.5 ),   IN2MM100( 13 ),     "FanFoldGerman",  NULL },
-    { MM2MM100( 100 ),   MM2MM100( 148 ),    "Postcard",  NULL },
-    { IN2MM100( 9 ),     IN2MM100( 11 ),     "9x11",  NULL },
-    { IN2MM100( 10 ),    IN2MM100( 11 ),     "10x11",  NULL },
-    { IN2MM100( 15 ),    IN2MM100( 11 ),     "15x11",  NULL },
-    { MM2MM100( 220 ),   MM2MM100( 220 ),    "EnvInvite",  NULL },
-    { MM2MM100( 227 ),   MM2MM100( 356 ),    "SuperA",  NULL },
-    { MM2MM100( 305 ),   MM2MM100( 487 ),    "SuperB",  NULL },
-    { IN2MM100( 8.5 ),   IN2MM100( 12.69 ),  "LetterPlus",  NULL },
-    { MM2MM100( 210 ),   MM2MM100( 330 ),    "A4Plus",  NULL },
-    { MM2MM100( 200 ),   MM2MM100( 148 ),    "DoublePostcard",  NULL },
-    { MM2MM100( 105 ),   MM2MM100( 148 ),    "A6",  NULL },
-    { IN2MM100( 12 ),    IN2MM100( 11 ),     "12x11",  NULL },
-    { MM2MM100( 74 ),    MM2MM100( 105 ),    "A7",  NULL },
-    { MM2MM100( 52 ),    MM2MM100( 74 ),     "A8",  NULL },
-    { MM2MM100( 37 ),    MM2MM100( 52 ),     "A9",  NULL },
-    { MM2MM100( 26 ),    MM2MM100( 37 ),     "A10",  NULL },
-    { MM2MM100( 1000 ),  MM2MM100( 1414 ),   "ISOB0",  NULL },
-    { MM2MM100( 707 ),   MM2MM100( 1000 ),   "ISOB1",  NULL },
-    { MM2MM100( 500 ),   MM2MM100( 707 ),    "ISOB2",  NULL },
-    { MM2MM100( 353 ),   MM2MM100( 500 ),    "ISOB3",  NULL },
-    { MM2MM100( 88 ),    MM2MM100( 125 ),    "ISOB7",  NULL },
-    { MM2MM100( 62 ),    MM2MM100( 88 ),     "ISOB8",  NULL },
-    { MM2MM100( 44 ),    MM2MM100( 62 ),     "ISOB9",  NULL },
-    { MM2MM100( 31 ),    MM2MM100( 44 ),     "ISOB10", NULL },
-    { MM2MM100( 458 ),   MM2MM100( 648 ),    "EnvC2",  "C2" },
-    { MM2MM100( 81 ),    MM2MM100( 114 ),    "EnvC7",  "C7" },
-    { MM2MM100( 57 ),    MM2MM100( 81 ),     "EnvC8",  "C8" },
-    { IN2MM100( 9 ),     IN2MM100( 12 ),     "ARCHA",  NULL },
-    { IN2MM100( 12 ),    IN2MM100( 18 ),     "ARCHB",  NULL },
-    { IN2MM100( 18 ),    IN2MM100( 24 ),     "ARCHC",  NULL },
-    { IN2MM100( 24 ),    IN2MM100( 36 ),     "ARCHD",  NULL },
-    { IN2MM100( 36 ),    IN2MM100( 48 ),     "ARCHE",  NULL }
-};
-
-static const size_t nTabSize = SAL_N_ELEMENTS(aDinTab);
-
-#define MAXSLOPPY 21
-
-bool PaperInfo::doSloppyFit()
-{
-    if (m_eType != PAPER_USER)
-        return true;
-
-    for ( size_t i = 0; i < nTabSize; ++i )
-    {
-        if (i == PAPER_USER) continue;
-
-        long lDiffW = labs(aDinTab[i].m_nWidth - m_nPaperWidth);
-        long lDiffH = labs(aDinTab[i].m_nHeight - m_nPaperHeight);
-
-        if ( lDiffW < MAXSLOPPY && lDiffH < MAXSLOPPY )
-        {
-            m_nPaperWidth = aDinTab[i].m_nWidth;
-            m_nPaperHeight = aDinTab[i].m_nHeight;
-            m_eType = (Paper)i;
-            return true;
-        }
-    }
-
-    return false;
-}
-
-bool PaperInfo::sloppyEqual(const PaperInfo &rOther) const
-{
-    return
-    (
-      (labs(m_nPaperWidth - rOther.m_nPaperWidth) < MAXSLOPPY) &&
-      (labs(m_nPaperHeight - rOther.m_nPaperHeight) < MAXSLOPPY)
-    );
-}
-
-long PaperInfo::sloppyFitPageDimension(long nDimension)
-{
-    for ( size_t i = 0; i < nTabSize; ++i )
-    {
-        if (i == PAPER_USER) continue;
-        long lDiff;
-
-        lDiff = labs(aDinTab[i].m_nWidth - nDimension);
-        if ( lDiff < MAXSLOPPY )
-            return aDinTab[i].m_nWidth;
-
-        lDiff = labs(aDinTab[i].m_nHeight - nDimension);
-        if ( lDiff < MAXSLOPPY )
-            return aDinTab[i].m_nHeight;
-    }
-    return nDimension;
-}
-
-PaperInfo PaperInfo::getSystemDefaultPaper()
-{
-    using ::com::sun::star::uno::Reference;
-    using ::com::sun::star::lang::XMultiServiceFactory;
-    using ::com::sun::star::uno::UNO_QUERY_THROW;
-    using ::com::sun::star::uno::Sequence;
-    using ::com::sun::star::uno::Any;
-    using ::com::sun::star::container::XNameAccess;
-    using ::com::sun::star::uno::Exception;
-#   define CREATE_OUSTRING( ascii ) \
-        rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
-
-    rtl::OUString aLocaleStr;
-
-    Reference< XMultiServiceFactory > xConfigProv;
-    Reference< XNameAccess > xConfigNA;
-    Sequence< Any > aArgs( 1 );
-    try
-    {
-        Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-        xConfigProv = Reference< XMultiServiceFactory >(
-            xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ),
-            UNO_QUERY_THROW);
-
-        aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.Setup/L10N/" );
-        xConfigNA = Reference< XNameAccess >(xConfigProv->createInstanceWithArguments(
-            CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW);
-
-        // try user-defined locale setting
-        xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= aLocaleStr;
-    }
-    catch(const Exception&)
-    {
-    }
-
-#ifdef UNX
-    // if set to "use system", get papersize from system
-    if (aLocaleStr.isEmpty())
-    {
-        static bool bInitialized = false;
-        static PaperInfo aInstance(PAPER_A4);
-
-        if (bInitialized)
-            return aInstance;
-
-        // try libpaper
-        // #i78617# workaround missing paperconf command
-        FILE* pPipe = popen( "sh -c paperconf 2>/dev/null", "r" );
-        if( pPipe )
-        {
-            Paper ePaper = PAPER_USER;
-
-            char aBuffer[ 1024 ];
-            aBuffer[0] = 0;
-            char *pBuffer = fgets( aBuffer, sizeof(aBuffer), pPipe );
-            pclose( pPipe );
-
-            if (pBuffer && *pBuffer != 0)
-            {
-                rtl::OString aPaper(pBuffer);
-                aPaper = aPaper.trim();
-                static struct { const char *pName; Paper ePaper; } aCustoms [] =
-                {
-                    { "B0",   PAPER_B0_ISO },
-                    { "B1",   PAPER_B1_ISO },
-                    { "B2",   PAPER_B2_ISO },
-                    { "B3",   PAPER_B3_ISO },
-                    { "B4",   PAPER_B4_ISO },
-                    { "B5",   PAPER_B5_ISO },
-                    { "B6",   PAPER_B6_ISO },
-                    { "B7",   PAPER_B7_ISO },
-                    { "B8",   PAPER_B8_ISO },
-                    { "B9",   PAPER_B9_ISO },
-                    { "B10",  PAPER_B10_ISO },
-                    { "folio", PAPER_FANFOLD_LEGAL_DE },
-                    { "flsa",  PAPER_FANFOLD_LEGAL_DE },
-                    { "flse",  PAPER_FANFOLD_LEGAL_DE }
-                };
-
-                bool bHalve = false;
-
-                size_t nExtraTabSize = SAL_N_ELEMENTS(aCustoms);
-                for (size_t i = 0; i < nExtraTabSize; ++i)
-                {
-                    if (rtl_str_compareIgnoreAsciiCase(aCustoms[i].pName, aPaper.getStr()) == 0)
-                    {
-                        ePaper = aCustoms[i].ePaper;
-                        break;
-                    }
-                }
-
-                if (ePaper == PAPER_USER)
-                {
-                    bHalve = !rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
-                        aPaper.getStr(), aPaper.getLength(),  "half", 4, 4);
-                    if (bHalve)
-                        aPaper = aPaper.copy(4);
-                    ePaper = PaperInfo::fromPSName(aPaper);
-                }
-
-                if (ePaper != PAPER_USER)
-                {
-                    aInstance = PaperInfo(ePaper);
-                    if (bHalve)
-                        aInstance = PaperInfo(aInstance.getHeight()/2, aInstance.getWidth());
-                    bInitialized = true;
-                    return aInstance;
-                }
-            }
-        }
-
-#if defined(LC_PAPER) && defined(_GNU_SOURCE)
-
-        union paperword { char *string; int word; };
-
-        // try LC_PAPER
-        paperword w, h;
-        w.string = nl_langinfo(_NL_PAPER_WIDTH);
-        h.string = nl_langinfo(_NL_PAPER_HEIGHT);
-
-        //glibc stores sizes as integer mm units
-        w.word *= 100;
-        h.word *= 100;
-
-        for ( size_t i = 0; i < nTabSize; ++i )
-        {
-            if (i == PAPER_USER) continue;
-
-            //glibc stores sizes as integer mm units, and so is inaccurate. To
-            //find a standard paper size we calculate the standard paper sizes
-            //into equally inaccurate mm and compare
-            long width = (aDinTab[i].m_nWidth + 50) / 100;
-            long height = (aDinTab[i].m_nHeight + 50) / 100;
-
-            if (width == w.word/100 && height == h.word/100)
-            {
-                w.word = aDinTab[i].m_nWidth;
-                h.word = aDinTab[i].m_nHeight;
-                break;
-            }
-        }
-
-        aInstance = PaperInfo(w.word, h.word);
-        bInitialized = true;
-        return aInstance;
-#endif
-    }
-#endif
-
-    try
-    {
-        // if set to "use system", try to get locale from system
-        if (aLocaleStr.isEmpty() && xConfigProv.is())
-        {
-            aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.System/L10N/" );
-            xConfigNA.set( xConfigProv->createInstanceWithArguments(
-                CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ),
-                UNO_QUERY_THROW );
-            xConfigNA->getByName( CREATE_OUSTRING( "Locale" ) ) >>= aLocaleStr;
-        }
-    }
-    catch(const Exception&)
-    {
-    }
-
-    if (aLocaleStr.isEmpty())
-        aLocaleStr = CREATE_OUSTRING("en-US");
-
-    // convert locale string to locale struct
-    ::com::sun::star::lang::Locale aSysLocale;
-    sal_Int32 nDashPos = aLocaleStr.indexOf( '-' );
-    if( nDashPos < 0 ) nDashPos = aLocaleStr.getLength();
-    aSysLocale.Language = aLocaleStr.copy( 0, nDashPos );
-    if( nDashPos + 1 < aLocaleStr.getLength() )
-        aSysLocale.Country = aLocaleStr.copy( nDashPos + 1 );
-
-    return PaperInfo::getDefaultPaperForLocale(aSysLocale);
-}
-
-PaperInfo::PaperInfo(Paper eType) : m_eType(eType)
-{
-    OSL_ENSURE( sizeof(aDinTab) / sizeof(aDinTab[0]) == NUM_PAPER_ENTRIES,
-            "mismatch between array entries and enum values" );
-
-    m_nPaperWidth = aDinTab[m_eType].m_nWidth;
-    m_nPaperHeight = aDinTab[m_eType].m_nHeight;
-}
-
-PaperInfo::PaperInfo(long nPaperWidth, long nPaperHeight)
-    : m_eType(PAPER_USER),
-      m_nPaperWidth(nPaperWidth),
-      m_nPaperHeight(nPaperHeight)
-{
-    for ( size_t i = 0; i < nTabSize; ++i )
-    {
-        if (
-             (nPaperWidth == aDinTab[i].m_nWidth) &&
-             (nPaperHeight == aDinTab[i].m_nHeight)
-           )
-        {
-            m_eType = static_cast<Paper>(i);
-            break;
-        }
-    }
-}
-
-rtl::OString PaperInfo::toPSName(Paper ePaper)
-{
-    return static_cast<size_t>(ePaper) < nTabSize ?
-        rtl::OString(aDinTab[ePaper].m_pPSName) : rtl::OString();
-}
-
-Paper PaperInfo::fromPSName(const rtl::OString &rName)
-{
-    if (rName.isEmpty())
-        return PAPER_USER;
-
-    for ( size_t i = 0; i < nTabSize; ++i )
-    {
-        if (aDinTab[i].m_pPSName &&
-          !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pPSName, rName.getStr()))
-        {
-            return static_cast<Paper>(i);
-        }
-        else if (aDinTab[i].m_pAltPSName &&
-          !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pAltPSName, rName.getStr()))
-        {
-            return static_cast<Paper>(i);
-        }
-    }
-
-    return PAPER_USER;
-}
-
-//http://wiki.services.openoffice.org/wiki/DefaultPaperSize
-//http://www.unicode.org/cldr/data/charts/supplemental/territory_language_information.html
-//http://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales
-//http://en.wikipedia.org/wiki/Paper_size
-//http://msdn.microsoft.com/en-us/library/cc195164.aspx
-PaperInfo PaperInfo::getDefaultPaperForLocale(
-    const ::com::sun::star::lang::Locale & rLocale)
-{
-    Paper eType = PAPER_A4;
-
-    if (
-        //United States, Letter
-        !rLocale.Country.compareToAscii("US") ||
-        //Puerto Rico:
-        //    http://unicode.org/cldr/trac/ticket/1710
-        //    http://sources.redhat.com/ml/libc-hacker/2001-07/msg00046.html
-        !rLocale.Country.compareToAscii("PR") ||
-        //Canada:
-        //    http://sources.redhat.com/ml/libc-hacker/2001-07/msg00053.html
-        !rLocale.Country.compareToAscii("CA") ||
-        //Venuzuela:
-        //    http://unicode.org/cldr/trac/ticket/1710
-        //    https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00019.html
-        !rLocale.Country.compareToAscii("VE") ||
-        //Chile:
-        //    http://unicode.org/cldr/trac/ticket/1710
-        //    https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00240.html
-        !rLocale.Country.compareToAscii("CL") ||
-        //Mexico:
-        //    http://unicode.org/cldr/trac/ticket/1710
-        //    http://qa.openoffice.org/issues/show_bug.cgi?id=49739
-        !rLocale.Country.compareToAscii("MX") ||
-        //Colombia:
-        //    http://unicode.org/cldr/trac/ticket/1710
-        //    http://qa.openoffice.org/issues/show_bug.cgi?id=69703
-        !rLocale.Country.compareToAscii("CO") ||
-        //Philippines:
-        //    http://unicode.org/cldr/trac/ticket/1710
-        //    http://ubuntuliving.blogspot.com/2008/07/default-paper-size-in-evince.html
-        //    http://www.gov.ph/faqs/driverslicense.asp
-        !rLocale.Country.compareToAscii("PH") ||
-        //Belize:
-        //    http://unicode.org/cldr/trac/ticket/2585
-        //    http://www.belize.gov.bz/ct.asp?xItem=1666&ctNode=486&mp=27
-        !rLocale.Country.compareToAscii("BZ") ||
-        //Costa Rica:
-        //    http://unicode.org/cldr/trac/ticket/2585
-        //    http://sources.redhat.com/bugzilla/show_bug.cgi?id=11258
-        !rLocale.Country.compareToAscii("CR") ||
-        //Guatemala:
-        //    http://unicode.org/cldr/trac/ticket/2585
-        //    http://sources.redhat.com/bugzilla/show_bug.cgi?id=10936
-        !rLocale.Country.compareToAscii("GT") ||
-        //Nicaragua:
-        //    http://unicode.org/cldr/trac/ticket/2585
-        !rLocale.Country.compareToAscii("NI") ||
-        //Panama:
-        //    http://unicode.org/cldr/trac/ticket/2585
-        //    http://www.minsa.gob.pa/minsa/tl_files/documents/baner_informativo/INSTRUMENTO%20DE%20INVESTIGACION%20DE%20RAAV%202009.pdf
-        !rLocale.Country.compareToAscii("PA") ||
-        //El Salvador:
-        //    http://unicode.org/cldr/trac/ticket/2585
-        //    http://www.tse.gob.sv
-        !rLocale.Country.compareToAscii("SV")
-       )
-    {
-        eType = PAPER_LETTER;
-    }
-
-    return eType;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/i18nutil/Library_i18nutil.mk b/i18nutil/Library_i18nutil.mk
index a05c3d0..990b1ca 100644
--- a/i18nutil/Library_i18nutil.mk
+++ b/i18nutil/Library_i18nutil.mk
@@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_linked_libs,i18nutil,\
 $(eval $(call gb_Library_add_exception_objects,i18nutil,\
 	i18nutil/source/utility/casefolding \
 	i18nutil/source/utility/oneToOneMapping \
+	i18nutil/source/utility/paper \
 	i18nutil/source/utility/scripttypedetector \
 	i18nutil/source/utility/unicode \
 	i18nutil/source/utility/widthfolding \
diff --git a/i18nutil/Package_inc.mk b/i18nutil/Package_inc.mk
index 3ea2b55..f72180e 100644
--- a/i18nutil/Package_inc.mk
+++ b/i18nutil/Package_inc.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Package_Package,i18nutil_inc,$(SRCDIR)/i18nutil/inc))
 $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/i18nutildllapi.h,i18nutil/i18nutildllapi.h))
 $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/casefolding.hxx,i18nutil/casefolding.hxx))
 $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/oneToOneMapping.hxx,i18nutil/oneToOneMapping.hxx))
+$(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/paper.hxx,i18nutil/paper.hxx))
 $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/scripttypedetector.hxx,i18nutil/scripttypedetector.hxx))
 $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/unicode.hxx,i18nutil/unicode.hxx))
 $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/widthfolding.hxx,i18nutil/widthfolding.hxx))
diff --git a/i18nutil/README b/i18nutil/README
new file mode 100644
index 0000000..6839c5d
--- /dev/null
+++ b/i18nutil/README
@@ -0,0 +1,4 @@
+i18nutil is internalization related utilties
+
+It comprises of honest c++ code which you just link to directly, while i18npool
+tends to consist of code you interact with via uno.
diff --git a/i18nutil/inc/i18nutil/paper.hxx b/i18nutil/inc/i18nutil/paper.hxx
new file mode 100644
index 0000000..d5be9ec
--- /dev/null
+++ b/i18nutil/inc/i18nutil/paper.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 INCLUDED_I18NUTIL_PAPER_HXX
+#define INCLUDED_I18NUTIL_PAPER_HXX
+
+#include "i18nutildllapi.h"
+#include <rtl/string.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+//!! WARNING: be aware of cui/source/tabpages/page.h where someone had the broken idea
+//!! of duplicating the values of this enum in order to use those defines within
+//!! src files.
+//!! Thus don't reorder the enum values here without changing the code there as well.
+enum Paper
+{
+    PAPER_A0,
+    PAPER_A1,
+    PAPER_A2,
+    PAPER_A3,
+    PAPER_A4,
+    PAPER_A5,
+    PAPER_B4_ISO,
+    PAPER_B5_ISO,
+    PAPER_LETTER,
+    PAPER_LEGAL,
+    PAPER_TABLOID,
+    PAPER_USER,
+    PAPER_B6_ISO,
+    PAPER_ENV_C4,
+    PAPER_ENV_C5,
+    PAPER_ENV_C6,
+    PAPER_ENV_C65,
+    PAPER_ENV_DL,
+    PAPER_SLIDE_DIA,
+    PAPER_SCREEN,
+    PAPER_C,
+    PAPER_D,
+    PAPER_E,
+    PAPER_EXECUTIVE,
+    PAPER_FANFOLD_LEGAL_DE,
+    PAPER_ENV_MONARCH,
+    PAPER_ENV_PERSONAL,
+    PAPER_ENV_9,
+    PAPER_ENV_10,
+    PAPER_ENV_11,
+    PAPER_ENV_12,
+    PAPER_KAI16,
+    PAPER_KAI32,
+    PAPER_KAI32BIG,
+    PAPER_B4_JIS,
+    PAPER_B5_JIS,
+    PAPER_B6_JIS,
+    PAPER_LEDGER,
+    PAPER_STATEMENT,
+    PAPER_QUARTO,
+    PAPER_10x14,
+    PAPER_ENV_14,
+    PAPER_ENV_C3,
+    PAPER_ENV_ITALY,
+    PAPER_FANFOLD_US,
+    PAPER_FANFOLD_DE,
+    PAPER_POSTCARD_JP,
+    PAPER_9x11,
+    PAPER_10x11,
+    PAPER_15x11,
+    PAPER_ENV_INVITE,
+    PAPER_A_PLUS,
+    PAPER_B_PLUS,
+    PAPER_LETTER_PLUS,
+    PAPER_A4_PLUS,
+    PAPER_DOUBLEPOSTCARD_JP,
+    PAPER_A6,
+    PAPER_12x11,
+    PAPER_A7,
+    PAPER_A8,
+    PAPER_A9,
+    PAPER_A10,
+    PAPER_B0_ISO,
+    PAPER_B1_ISO,
+    PAPER_B2_ISO,
+    PAPER_B3_ISO,
+    PAPER_B7_ISO,
+    PAPER_B8_ISO,
+    PAPER_B9_ISO,
+    PAPER_B10_ISO,
+    PAPER_ENV_C2,
+    PAPER_ENV_C7,
+    PAPER_ENV_C8,
+    PAPER_ARCHA,
+    PAPER_ARCHB,
+    PAPER_ARCHC,
+    PAPER_ARCHD,
+    PAPER_ARCHE
+};
+
+// defined for 'equal size' test with the implementation array
+#define NUM_PAPER_ENTRIES   (PAPER_ARCHE - PAPER_A0 + 1)
+
+// ---------
+// - Paper -
+// ---------
+
+class I18NUTIL_DLLPUBLIC PaperInfo
+{
+    Paper m_eType;
+    long m_nPaperWidth;     // width in 100thMM
+    long m_nPaperHeight;    // height in 100thMM
+public:
+    PaperInfo(Paper eType);
+    PaperInfo(long nPaperWidth, long nPaperHeight);
+
+    Paper getPaper() const { return m_eType; }
+    long getWidth() const { return m_nPaperWidth; }
+    long getHeight() const { return m_nPaperHeight; }
+    bool sloppyEqual(const PaperInfo &rOther) const;
+    bool doSloppyFit();
+
+    static PaperInfo getSystemDefaultPaper();
+    static PaperInfo getDefaultPaperForLocale(const ::com::sun::star::lang::Locale & rLocale);
+
+    static Paper fromPSName(const rtl::OString &rName);
+    static rtl::OString toPSName(Paper eType);
+
+    static long sloppyFitPageDimension(long nDimension);
+};
+
+#endif // INCLUDED_I18NUTIL_PAPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx
new file mode 100644
index 0000000..63b5cff
--- /dev/null
+++ b/i18nutil/source/utility/paper.cxx
@@ -0,0 +1,522 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#include <osl/diagnose.h>
+#include <sal/config.h>
+#include <sal/macros.h>
+#include <rtl/ustring.hxx>
+#include <rtl/string.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include "i18nutil/paper.hxx"
+
+#include <utility>
+#include <cstdlib>
+
+#ifdef UNX
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+#if defined(LC_PAPER) && defined(_GNU_SOURCE)
+#include <langinfo.h>
+#endif
+#endif
+
+struct PageDesc
+{
+    long m_nWidth;
+    long m_nHeight;
+    const char *m_pPSName;
+    const char *m_pAltPSName;
+};
+
+#define PT2MM100( v ) \
+    (long)(((v) * 35.27777778) + 0.5)
+
+#define IN2MM100( v ) \
+    ((long)(((v) * 2540) + 0.5))
+
+#define MM2MM100( v ) \
+    ((long)((v) * 100))
+
+//PostScript Printer Description File Format Specification
+//http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
+//http://www.y-adagio.com/public/committees/docsii/doc_00-49/symp_ulaan/china_ppr.pdf (Kai)
+//http://www.sls.psi.ch/controls/help/howto/Howto_Print_a_A0_Poster_at_WSLA_012_2.pdf (Dia)
+static PageDesc aDinTab[] =
+{
+    { MM2MM100( 841 ),   MM2MM100( 1189 ),   "A0",  NULL },
+    { MM2MM100( 594 ),   MM2MM100( 841 ),    "A1",  NULL },
+    { MM2MM100( 420 ),   MM2MM100( 594 ),    "A2",  NULL },
+    { MM2MM100( 297 ),   MM2MM100( 420 ),    "A3",  NULL },
+    { MM2MM100( 210 ),   MM2MM100( 297 ),    "A4",  NULL },
+    { MM2MM100( 148 ),   MM2MM100( 210 ),    "A5",  NULL },
+    { MM2MM100( 250 ),   MM2MM100( 353 ),    "ISOB4",  NULL },
+    { MM2MM100( 176 ),   MM2MM100( 250 ),    "ISOB5",  NULL },
+    { IN2MM100( 8.5 ),   IN2MM100( 11 ),     "Letter",  "Note" },
+    { IN2MM100( 8.5 ),   IN2MM100( 14 ),     "Legal",  NULL },
+    { IN2MM100( 11 ),    IN2MM100( 17 ),     "Tabloid",  "11x17" },
+    { 0,                 0,                  NULL, NULL }, //User
+    { MM2MM100( 125 ),   MM2MM100( 176 ),    "ISOB6",  NULL },
+    { MM2MM100( 229 ),   MM2MM100( 324 ),    "EnvC4",  "C4" },
+    { MM2MM100( 162 ),   MM2MM100( 229 ),    "EnvC5",  "C5" },
+    { MM2MM100( 114 ),   MM2MM100( 162 ),    "EnvC6",  "C6" },
+    { MM2MM100( 114 ),   MM2MM100( 229 ),    "EnvC65", NULL },
+    { MM2MM100( 110 ),   MM2MM100( 220 ),    "EnvDL",  "DL" },
+    { MM2MM100( 180),    MM2MM100( 270 ),    NULL,  NULL }, //Dia
+    { MM2MM100( 210),    MM2MM100( 280 ),    NULL,  NULL }, //Screen
+    { IN2MM100( 17 ),    IN2MM100( 22 ),     "AnsiC",  "CSheet" },
+    { IN2MM100( 22 ),    IN2MM100( 34 ),     "AnsiD",  "DSheet" },
+    { IN2MM100( 34 ),    IN2MM100( 44 ),     "AnsiE",  "ESheet" },
+    { IN2MM100( 7.25 ),  IN2MM100( 10.5 ),   "Executive",  NULL },
+    //"Folio" is a different size in the PPD documentation than 8.5x11
+    //This "FanFoldGermanLegal" is known in the Philippines as
+    //"Legal" paper or "Long Bond Paper".  The "Legal" name causing untold
+    //misery, given the differently sized US "Legal" paper
+    { IN2MM100( 8.5 ),   IN2MM100( 13 ),     "FanFoldGermanLegal",  NULL },
+    { IN2MM100( 3.875 ), IN2MM100( 7.5 ),    "EnvMonarch", "Monarch" },
+    { IN2MM100( 3.625 ), IN2MM100( 6.5 ),    "EnvPersonal",  "Personal" },
+    { IN2MM100( 3.875 ), IN2MM100( 8.875 ),  "Env9",  NULL },
+    { IN2MM100( 4.125 ), IN2MM100( 9.5 ),    "Env10",  "Comm10" },
+    { IN2MM100( 4.5 ),   IN2MM100( 10.375 ), "Env11",  NULL },
+    { IN2MM100( 4.75 ),  IN2MM100( 11 ),     "Env12",  NULL },
+    { MM2MM100( 184 ),   MM2MM100( 260 ),    NULL,  NULL }, //Kai16
+    { MM2MM100( 130 ),   MM2MM100( 184 ),    NULL,  NULL }, //Kai32
+    { MM2MM100( 140 ),   MM2MM100( 203 ),    NULL,  NULL }, //BigKai32
+    { MM2MM100( 257 ),   MM2MM100( 364 ),    "B4",  NULL }, //JIS
+    { MM2MM100( 182 ),   MM2MM100( 257 ),    "B5",  NULL }, //JIS
+    { MM2MM100( 128 ),   MM2MM100( 182 ),    "B6",  NULL }, //JIS
+    { IN2MM100( 17 ),    IN2MM100( 11 ),     "Ledger",  NULL },
+    { IN2MM100( 5.5 ),   IN2MM100( 8.5 ),    "Statement",  NULL },
+    { PT2MM100( 610 ),   PT2MM100( 780 ),    "Quarto",  NULL },
+    { IN2MM100( 10 ),    IN2MM100( 14 ),     "10x14",  NULL },
+    { IN2MM100( 5.5 ),   IN2MM100( 11.5 ),   "Env14",  NULL },
+    { MM2MM100( 324 ),   MM2MM100( 458 ),    "EnvC3",  "C3" },
+    { MM2MM100( 110 ),   MM2MM100( 230 ),    "EnvItalian",  NULL },
+    { IN2MM100( 14.875 ),IN2MM100( 11 ),     "FanFoldUS",  NULL },
+    { IN2MM100( 8.5 ),   IN2MM100( 13 ),     "FanFoldGerman",  NULL },
+    { MM2MM100( 100 ),   MM2MM100( 148 ),    "Postcard",  NULL },
+    { IN2MM100( 9 ),     IN2MM100( 11 ),     "9x11",  NULL },
+    { IN2MM100( 10 ),    IN2MM100( 11 ),     "10x11",  NULL },
+    { IN2MM100( 15 ),    IN2MM100( 11 ),     "15x11",  NULL },
+    { MM2MM100( 220 ),   MM2MM100( 220 ),    "EnvInvite",  NULL },
+    { MM2MM100( 227 ),   MM2MM100( 356 ),    "SuperA",  NULL },
+    { MM2MM100( 305 ),   MM2MM100( 487 ),    "SuperB",  NULL },
+    { IN2MM100( 8.5 ),   IN2MM100( 12.69 ),  "LetterPlus",  NULL },
+    { MM2MM100( 210 ),   MM2MM100( 330 ),    "A4Plus",  NULL },
+    { MM2MM100( 200 ),   MM2MM100( 148 ),    "DoublePostcard",  NULL },
+    { MM2MM100( 105 ),   MM2MM100( 148 ),    "A6",  NULL },
+    { IN2MM100( 12 ),    IN2MM100( 11 ),     "12x11",  NULL },
+    { MM2MM100( 74 ),    MM2MM100( 105 ),    "A7",  NULL },
+    { MM2MM100( 52 ),    MM2MM100( 74 ),     "A8",  NULL },
+    { MM2MM100( 37 ),    MM2MM100( 52 ),     "A9",  NULL },
+    { MM2MM100( 26 ),    MM2MM100( 37 ),     "A10",  NULL },
+    { MM2MM100( 1000 ),  MM2MM100( 1414 ),   "ISOB0",  NULL },
+    { MM2MM100( 707 ),   MM2MM100( 1000 ),   "ISOB1",  NULL },
+    { MM2MM100( 500 ),   MM2MM100( 707 ),    "ISOB2",  NULL },
+    { MM2MM100( 353 ),   MM2MM100( 500 ),    "ISOB3",  NULL },
+    { MM2MM100( 88 ),    MM2MM100( 125 ),    "ISOB7",  NULL },
+    { MM2MM100( 62 ),    MM2MM100( 88 ),     "ISOB8",  NULL },
+    { MM2MM100( 44 ),    MM2MM100( 62 ),     "ISOB9",  NULL },
+    { MM2MM100( 31 ),    MM2MM100( 44 ),     "ISOB10", NULL },
+    { MM2MM100( 458 ),   MM2MM100( 648 ),    "EnvC2",  "C2" },
+    { MM2MM100( 81 ),    MM2MM100( 114 ),    "EnvC7",  "C7" },
+    { MM2MM100( 57 ),    MM2MM100( 81 ),     "EnvC8",  "C8" },
+    { IN2MM100( 9 ),     IN2MM100( 12 ),     "ARCHA",  NULL },
+    { IN2MM100( 12 ),    IN2MM100( 18 ),     "ARCHB",  NULL },
+    { IN2MM100( 18 ),    IN2MM100( 24 ),     "ARCHC",  NULL },
+    { IN2MM100( 24 ),    IN2MM100( 36 ),     "ARCHD",  NULL },
+    { IN2MM100( 36 ),    IN2MM100( 48 ),     "ARCHE",  NULL }
+};
+
+static const size_t nTabSize = SAL_N_ELEMENTS(aDinTab);
+
+#define MAXSLOPPY 21
+
+bool PaperInfo::doSloppyFit()
+{
+    if (m_eType != PAPER_USER)
+        return true;
+
+    for ( size_t i = 0; i < nTabSize; ++i )
+    {
+        if (i == PAPER_USER) continue;
+
+        long lDiffW = labs(aDinTab[i].m_nWidth - m_nPaperWidth);
+        long lDiffH = labs(aDinTab[i].m_nHeight - m_nPaperHeight);
+
+        if ( lDiffW < MAXSLOPPY && lDiffH < MAXSLOPPY )
+        {
+            m_nPaperWidth = aDinTab[i].m_nWidth;
+            m_nPaperHeight = aDinTab[i].m_nHeight;
+            m_eType = (Paper)i;
+            return true;
+        }
+    }
+
+    return false;
+}
+
+bool PaperInfo::sloppyEqual(const PaperInfo &rOther) const
+{
+    return
+    (
+      (labs(m_nPaperWidth - rOther.m_nPaperWidth) < MAXSLOPPY) &&
+      (labs(m_nPaperHeight - rOther.m_nPaperHeight) < MAXSLOPPY)
+    );
+}
+
+long PaperInfo::sloppyFitPageDimension(long nDimension)
+{
+    for ( size_t i = 0; i < nTabSize; ++i )
+    {
+        if (i == PAPER_USER) continue;
+        long lDiff;
+
+        lDiff = labs(aDinTab[i].m_nWidth - nDimension);
+        if ( lDiff < MAXSLOPPY )
+            return aDinTab[i].m_nWidth;
+
+        lDiff = labs(aDinTab[i].m_nHeight - nDimension);
+        if ( lDiff < MAXSLOPPY )
+            return aDinTab[i].m_nHeight;
+    }
+    return nDimension;
+}
+
+PaperInfo PaperInfo::getSystemDefaultPaper()
+{
+    using ::com::sun::star::uno::Reference;
+    using ::com::sun::star::lang::XMultiServiceFactory;
+    using ::com::sun::star::uno::UNO_QUERY_THROW;
+    using ::com::sun::star::uno::Sequence;
+    using ::com::sun::star::uno::Any;
+    using ::com::sun::star::container::XNameAccess;
+    using ::com::sun::star::uno::Exception;
+#   define CREATE_OUSTRING( ascii ) \
+        rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
+
+    rtl::OUString aLocaleStr;
+
+    Reference< XMultiServiceFactory > xConfigProv;
+    Reference< XNameAccess > xConfigNA;
+    Sequence< Any > aArgs( 1 );
+    try
+    {
+        Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+        xConfigProv = Reference< XMultiServiceFactory >(
+            xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ),
+            UNO_QUERY_THROW);
+
+        aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.Setup/L10N/" );
+        xConfigNA = Reference< XNameAccess >(xConfigProv->createInstanceWithArguments(
+            CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW);
+
+        // try user-defined locale setting
+        xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= aLocaleStr;
+    }
+    catch(const Exception&)
+    {
+    }
+
+#ifdef UNX
+    // if set to "use system", get papersize from system
+    if (aLocaleStr.isEmpty())
+    {
+        static bool bInitialized = false;
+        static PaperInfo aInstance(PAPER_A4);
+
+        if (bInitialized)
+            return aInstance;
+
+        // try libpaper
+        // #i78617# workaround missing paperconf command
+        FILE* pPipe = popen( "sh -c paperconf 2>/dev/null", "r" );
+        if( pPipe )
+        {
+            Paper ePaper = PAPER_USER;
+
+            char aBuffer[ 1024 ];
+            aBuffer[0] = 0;
+            char *pBuffer = fgets( aBuffer, sizeof(aBuffer), pPipe );
+            pclose( pPipe );
+
+            if (pBuffer && *pBuffer != 0)
+            {
+                rtl::OString aPaper(pBuffer);
+                aPaper = aPaper.trim();
+                static struct { const char *pName; Paper ePaper; } aCustoms [] =
+                {
+                    { "B0",   PAPER_B0_ISO },
+                    { "B1",   PAPER_B1_ISO },
+                    { "B2",   PAPER_B2_ISO },
+                    { "B3",   PAPER_B3_ISO },
+                    { "B4",   PAPER_B4_ISO },
+                    { "B5",   PAPER_B5_ISO },
+                    { "B6",   PAPER_B6_ISO },
+                    { "B7",   PAPER_B7_ISO },
+                    { "B8",   PAPER_B8_ISO },
+                    { "B9",   PAPER_B9_ISO },
+                    { "B10",  PAPER_B10_ISO },
+                    { "folio", PAPER_FANFOLD_LEGAL_DE },
+                    { "flsa",  PAPER_FANFOLD_LEGAL_DE },
+                    { "flse",  PAPER_FANFOLD_LEGAL_DE }
+                };
+
+                bool bHalve = false;
+
+                size_t nExtraTabSize = SAL_N_ELEMENTS(aCustoms);
+                for (size_t i = 0; i < nExtraTabSize; ++i)
+                {
+                    if (rtl_str_compareIgnoreAsciiCase(aCustoms[i].pName, aPaper.getStr()) == 0)
+                    {
+                        ePaper = aCustoms[i].ePaper;
+                        break;
+                    }
+                }
+
+                if (ePaper == PAPER_USER)
+                {
+                    bHalve = !rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
+                        aPaper.getStr(), aPaper.getLength(),  "half", 4, 4);
+                    if (bHalve)
+                        aPaper = aPaper.copy(4);
+                    ePaper = PaperInfo::fromPSName(aPaper);
+                }
+
+                if (ePaper != PAPER_USER)
+                {
+                    aInstance = PaperInfo(ePaper);
+                    if (bHalve)
+                        aInstance = PaperInfo(aInstance.getHeight()/2, aInstance.getWidth());
+                    bInitialized = true;
+                    return aInstance;
+                }
+            }
+        }
+
+#if defined(LC_PAPER) && defined(_GNU_SOURCE)
+
+        union paperword { char *string; int word; };
+
+        // try LC_PAPER
+        paperword w, h;
+        w.string = nl_langinfo(_NL_PAPER_WIDTH);
+        h.string = nl_langinfo(_NL_PAPER_HEIGHT);
+
+        //glibc stores sizes as integer mm units
+        w.word *= 100;
+        h.word *= 100;
+
+        for ( size_t i = 0; i < nTabSize; ++i )
+        {
+            if (i == PAPER_USER) continue;
+
+            //glibc stores sizes as integer mm units, and so is inaccurate. To
+            //find a standard paper size we calculate the standard paper sizes
+            //into equally inaccurate mm and compare
+            long width = (aDinTab[i].m_nWidth + 50) / 100;
+            long height = (aDinTab[i].m_nHeight + 50) / 100;
+
+            if (width == w.word/100 && height == h.word/100)
+            {
+                w.word = aDinTab[i].m_nWidth;
+                h.word = aDinTab[i].m_nHeight;
+                break;
+            }
+        }
+
+        aInstance = PaperInfo(w.word, h.word);
+        bInitialized = true;
+        return aInstance;
+#endif
+    }
+#endif
+
+    try
+    {
+        // if set to "use system", try to get locale from system
+        if (aLocaleStr.isEmpty() && xConfigProv.is())
+        {
+            aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.System/L10N/" );
+            xConfigNA.set( xConfigProv->createInstanceWithArguments(
+                CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ),
+                UNO_QUERY_THROW );
+            xConfigNA->getByName( CREATE_OUSTRING( "Locale" ) ) >>= aLocaleStr;
+        }
+    }
+    catch(const Exception&)
+    {
+    }
+
+    if (aLocaleStr.isEmpty())
+        aLocaleStr = CREATE_OUSTRING("en-US");
+
+    // convert locale string to locale struct
+    ::com::sun::star::lang::Locale aSysLocale;
+    sal_Int32 nDashPos = aLocaleStr.indexOf( '-' );
+    if( nDashPos < 0 ) nDashPos = aLocaleStr.getLength();
+    aSysLocale.Language = aLocaleStr.copy( 0, nDashPos );
+    if( nDashPos + 1 < aLocaleStr.getLength() )
+        aSysLocale.Country = aLocaleStr.copy( nDashPos + 1 );
+
+    return PaperInfo::getDefaultPaperForLocale(aSysLocale);
+}
+
+PaperInfo::PaperInfo(Paper eType) : m_eType(eType)
+{
+    OSL_ENSURE( sizeof(aDinTab) / sizeof(aDinTab[0]) == NUM_PAPER_ENTRIES,
+            "mismatch between array entries and enum values" );
+
+    m_nPaperWidth = aDinTab[m_eType].m_nWidth;
+    m_nPaperHeight = aDinTab[m_eType].m_nHeight;
+}
+
+PaperInfo::PaperInfo(long nPaperWidth, long nPaperHeight)
+    : m_eType(PAPER_USER),
+      m_nPaperWidth(nPaperWidth),
+      m_nPaperHeight(nPaperHeight)
+{
+    for ( size_t i = 0; i < nTabSize; ++i )
+    {
+        if (
+             (nPaperWidth == aDinTab[i].m_nWidth) &&
+             (nPaperHeight == aDinTab[i].m_nHeight)
+           )
+        {
+            m_eType = static_cast<Paper>(i);
+            break;
+        }
+    }
+}
+
+rtl::OString PaperInfo::toPSName(Paper ePaper)
+{
+    return static_cast<size_t>(ePaper) < nTabSize ?
+        rtl::OString(aDinTab[ePaper].m_pPSName) : rtl::OString();
+}
+
+Paper PaperInfo::fromPSName(const rtl::OString &rName)
+{
+    if (rName.isEmpty())
+        return PAPER_USER;
+
+    for ( size_t i = 0; i < nTabSize; ++i )
+    {
+        if (aDinTab[i].m_pPSName &&
+          !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pPSName, rName.getStr()))
+        {
+            return static_cast<Paper>(i);
+        }
+        else if (aDinTab[i].m_pAltPSName &&
+          !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pAltPSName, rName.getStr()))
+        {
+            return static_cast<Paper>(i);
+        }
+    }
+
+    return PAPER_USER;
+}
+
+//http://wiki.services.openoffice.org/wiki/DefaultPaperSize
+//http://www.unicode.org/cldr/data/charts/supplemental/territory_language_information.html
+//http://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales
+//http://en.wikipedia.org/wiki/Paper_size
+//http://msdn.microsoft.com/en-us/library/cc195164.aspx
+PaperInfo PaperInfo::getDefaultPaperForLocale(
+    const ::com::sun::star::lang::Locale & rLocale)
+{
+    Paper eType = PAPER_A4;
+
+    if (
+        //United States, Letter
+        !rLocale.Country.compareToAscii("US") ||
+        //Puerto Rico:
+        //    http://unicode.org/cldr/trac/ticket/1710
+        //    http://sources.redhat.com/ml/libc-hacker/2001-07/msg00046.html
+        !rLocale.Country.compareToAscii("PR") ||
+        //Canada:
+        //    http://sources.redhat.com/ml/libc-hacker/2001-07/msg00053.html
+        !rLocale.Country.compareToAscii("CA") ||
+        //Venuzuela:
+        //    http://unicode.org/cldr/trac/ticket/1710
+        //    https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00019.html
+        !rLocale.Country.compareToAscii("VE") ||
+        //Chile:
+        //    http://unicode.org/cldr/trac/ticket/1710
+        //    https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00240.html
+        !rLocale.Country.compareToAscii("CL") ||
+        //Mexico:
+        //    http://unicode.org/cldr/trac/ticket/1710
+        //    http://qa.openoffice.org/issues/show_bug.cgi?id=49739
+        !rLocale.Country.compareToAscii("MX") ||
+        //Colombia:
+        //    http://unicode.org/cldr/trac/ticket/1710
+        //    http://qa.openoffice.org/issues/show_bug.cgi?id=69703
+        !rLocale.Country.compareToAscii("CO") ||
+        //Philippines:
+        //    http://unicode.org/cldr/trac/ticket/1710
+        //    http://ubuntuliving.blogspot.com/2008/07/default-paper-size-in-evince.html
+        //    http://www.gov.ph/faqs/driverslicense.asp
+        !rLocale.Country.compareToAscii("PH") ||
+        //Belize:
+        //    http://unicode.org/cldr/trac/ticket/2585
+        //    http://www.belize.gov.bz/ct.asp?xItem=1666&ctNode=486&mp=27
+        !rLocale.Country.compareToAscii("BZ") ||
+        //Costa Rica:
+        //    http://unicode.org/cldr/trac/ticket/2585
+        //    http://sources.redhat.com/bugzilla/show_bug.cgi?id=11258
+        !rLocale.Country.compareToAscii("CR") ||
+        //Guatemala:
+        //    http://unicode.org/cldr/trac/ticket/2585
+        //    http://sources.redhat.com/bugzilla/show_bug.cgi?id=10936
+        !rLocale.Country.compareToAscii("GT") ||
+        //Nicaragua:
+        //    http://unicode.org/cldr/trac/ticket/2585
+        !rLocale.Country.compareToAscii("NI") ||
+        //Panama:
+        //    http://unicode.org/cldr/trac/ticket/2585
+        //    http://www.minsa.gob.pa/minsa/tl_files/documents/baner_informativo/INSTRUMENTO%20DE%20INVESTIGACION%20DE%20RAAV%202009.pdf
+        !rLocale.Country.compareToAscii("PA") ||
+        //El Salvador:
+        //    http://unicode.org/cldr/trac/ticket/2585
+        //    http://www.tse.gob.sv
+        !rLocale.Country.compareToAscii("SV")
+       )
+    {
+        eType = PAPER_LETTER;
+    }
+
+    return eType;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx
index 16f0562..32be9b8 100644
--- a/sc/source/ui/vba/vbapagesetup.cxx
+++ b/sc/source/ui/vba/vbapagesetup.cxx
@@ -38,7 +38,7 @@
 #include <ooo/vba/excel/XlPageOrientation.hpp>
 #include <ooo/vba/excel/XlOrder.hpp>
 #include <ooo/vba/excel/Constants.hpp>
-#include <i18npool/paper.hxx>
+#include <i18nutil/paper.hxx>
 #include <editeng/paperinf.hxx>
 #include <ooo/vba/excel/XlPaperSize.hpp>
 #include <sal/macros.h>
diff --git a/solenv/inc/libs.mk b/solenv/inc/libs.mk
index 0e164f4..55bf2bf 100644
--- a/solenv/inc/libs.mk
+++ b/solenv/inc/libs.mk
@@ -69,7 +69,6 @@ ICUDATALIB=-licudata
 .ENDIF
 I18NUTILLIB=-li18nutil$(COMID)
 I18NISOLANGLIB=-li18nisolang$(ISOLANG_MAJOR)$(COMID)
-I18NPAPERLIB=-li18npaper$(DLLPOSTFIX)
 I18NREGEXPLIB=-li18nregexp$(DLLPOSTFIX)
 SALHELPERLIB=-luno_salhelper$(COMID_WITH_VERSION)
 XMLSCRIPTLIB =-lxcr$(DLLPOSTFIX)
@@ -359,7 +358,7 @@ UNOTOOLSLIB+=$(UCBHELPERLIB)
 TOOLSLIB+=$(BASEGFXLIB)
 TOOLSLIB+=$(ZLIB3RDLIB)
 
-VCLLIB+=$(ICUUCLIB) $(I18NPAPERLIB)
+VCLLIB+=$(ICUUCLIB)
 
 .ENDIF
 
@@ -385,7 +384,6 @@ ICUUCLIB=icuuc.lib
 ICUDATALIB=icudt.lib
 I18NUTILLIB=ii18nutil.lib
 I18NISOLANGLIB=ii18nisolang.lib
-I18NPAPERLIB=ii18npaper.lib
 I18NREGEXPLIB=ii18nregexp.lib
 SALHELPERLIB=isalhelper.lib
 XMLSCRIPTLIB=ixcr.lib
diff --git a/starmath/CppunitTest_starmath_qa_cppunit.mk b/starmath/CppunitTest_starmath_qa_cppunit.mk
index 3c73abb..24ba902 100644
--- a/starmath/CppunitTest_starmath_qa_cppunit.mk
+++ b/starmath/CppunitTest_starmath_qa_cppunit.mk
@@ -54,7 +54,7 @@ $(eval $(call gb_CppunitTest_add_linked_libs,starmath_qa_cppunit,\
     cppuhelper \
     editeng \
     i18nisolang1 \
-    i18npaper \
+    i18nutil \
     sal \
     sfx \
     sot \
diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk
index b5d2ea1..110fa23 100644
--- a/starmath/Library_sm.mk
+++ b/starmath/Library_sm.mk
@@ -42,7 +42,7 @@ $(eval $(call gb_Library_add_linked_libs,sm,\
 	cppu \
 	cppuhelper \
 	editeng \
-	i18npaper \
+	i18nutil \
 	msfilter \
 	oox \
 	sal \
diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx
index 34ae144..93186f5 100644
--- a/sw/inc/breakit.hxx
+++ b/sw/inc/breakit.hxx
@@ -60,7 +60,6 @@ class SW_DLLPUBLIC SwBreakIt
     void _GetForbidden( const LanguageType  aLang );
 
     void createBreakIterator() const;
-    void createScriptTypeDetector();
 
     // forbidden and not implemented.
     SwBreakIt();
diff --git a/vcl/Library_desktop_detector.mk b/vcl/Library_desktop_detector.mk
index bae9265..a4357fa 100644
--- a/vcl/Library_desktop_detector.mk
+++ b/vcl/Library_desktop_detector.mk
@@ -55,7 +55,6 @@ $(eval $(call gb_Library_add_linked_libs,desktop_detector,\
     comphelper \
     cppuhelper \
     i18nisolang1 \
-    i18npaper \
     i18nutil \
     jvmaccess \
     cppu \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 3e4aa8a..a1beef2 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -73,7 +73,6 @@ $(eval $(call gb_Library_add_linked_libs,vcl,\
     comphelper \
     cppuhelper \
     i18nisolang1 \
-    i18npaper \
     i18nutil \
     cppu \
     sal \
diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk
index 4be0bfc..c665284 100644
--- a/vcl/Library_vclplug_gen.mk
+++ b/vcl/Library_vclplug_gen.mk
@@ -49,7 +49,6 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_gen,\
     comphelper \
     cppuhelper \
     i18nisolang1 \
-    i18npaper \
     i18nutil \
     jvmaccess \
     cppu \
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index b5a6eb0..201daa3 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -57,7 +57,6 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_gtk,\
     comphelper \
     cppuhelper \
     i18nisolang1 \
-    i18npaper \
     i18nutil \
     jvmaccess \
     cppu \
diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
index 0b85964..d35787a 100644
--- a/vcl/Library_vclplug_gtk3.mk
+++ b/vcl/Library_vclplug_gtk3.mk
@@ -69,7 +69,6 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_gtk3,\
     comphelper \
     cppuhelper \
     i18nisolang1 \
-    i18npaper \
     i18nutil \
     jvmaccess \
     cppu \
diff --git a/vcl/Library_vclplug_kde.mk b/vcl/Library_vclplug_kde.mk
index 3f9e66a..3735c5c 100644
--- a/vcl/Library_vclplug_kde.mk
+++ b/vcl/Library_vclplug_kde.mk
@@ -63,7 +63,6 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_kde,\
     comphelper \
     cppuhelper \
     i18nisolang1 \
-    i18npaper \
     i18nutil \
     jvmaccess \
     cppu \
diff --git a/vcl/Library_vclplug_kde4.mk b/vcl/Library_vclplug_kde4.mk
index 311d86d..9d8dfb3 100644
--- a/vcl/Library_vclplug_kde4.mk
+++ b/vcl/Library_vclplug_kde4.mk
@@ -66,7 +66,6 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_kde4,\
     comphelper \
     cppuhelper \
     i18nisolang1 \
-    i18npaper \
     i18nutil \
     jvmaccess \
     cppu \
diff --git a/vcl/Library_vclplug_svp.mk b/vcl/Library_vclplug_svp.mk
index f96109d..8bb14d6 100644
--- a/vcl/Library_vclplug_svp.mk
+++ b/vcl/Library_vclplug_svp.mk
@@ -58,7 +58,6 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_svp,\
     comphelper \
     cppuhelper \
     i18nisolang1 \
-    i18npaper \
     i18nutil \
     jvmaccess \
     cppu \
diff --git a/vcl/inc/vcl/prntypes.hxx b/vcl/inc/vcl/prntypes.hxx
index f1c05b5..e660428 100644
--- a/vcl/inc/vcl/prntypes.hxx
+++ b/vcl/inc/vcl/prntypes.hxx
@@ -30,7 +30,7 @@
 #define _SV_PRNTYPES_HXX
 
 #include <vcl/sv.h>
-#include <i18npool/paper.hxx>
+#include <i18nutil/paper.hxx>
 
 // ---------------
 // - Duplex Mode -
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 48b5b02..d8d6f9b 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -42,7 +42,7 @@
 #include "tools/debug.hxx"
 #include "tools/config.hxx"
 
-#include "i18npool/paper.hxx"
+#include "i18nutil/paper.hxx"
 #include <comphelper/string.hxx>
 #include "rtl/strbuf.hxx"
 #include <sal/macros.h>
diff --git a/writerfilter/Library_ooxml.mk b/writerfilter/Library_ooxml.mk
index 5cea549..94b1e00 100644
--- a/writerfilter/Library_ooxml.mk
+++ b/writerfilter/Library_ooxml.mk
@@ -56,7 +56,7 @@ $(eval $(call gb_Library_add_linked_libs,ooxml,\
     cppuhelper \
 	doctok \
 	i18nisolang1 \
-	i18npaper \
+	i18nutil \
     oox \
 	resourcemodel \
     sal \
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk
index e0c4f88..5fe7556 100644
--- a/writerfilter/Library_writerfilter.mk
+++ b/writerfilter/Library_writerfilter.mk
@@ -53,7 +53,7 @@ $(eval $(call gb_Library_add_linked_libs,writerfilter,\
     cppuhelper \
 	doctok \
     i18nisolang1 \
-    i18npaper \
+    i18nutil \
     oox \
     ooxml \
     rtftok \
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 34c23f7..54be384 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -33,7 +33,7 @@
 #include <ModelEventListener.hxx>
 #include <MeasureHandler.hxx>
 #include <i18npool/mslangid.hxx>
-#include <i18npool/paper.hxx>
+#include <i18nutil/paper.hxx>
 #include <ooxml/OOXMLFastTokens.hxx>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 6230d1b..575730f 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -29,7 +29,7 @@
 #include <ooxml/resourceids.hxx>
 #include <DomainMapper_Impl.hxx>
 #include <ConversionHelper.hxx>
-#include <i18npool/paper.hxx>
+#include <i18nutil/paper.hxx>
 #include <rtl/oustringostreaminserter.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
commit 18a48b7489650c7addef4c64b7c5b6985a3c68fe
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 8 00:39:09 2012 +0000

    drop dead makefile.mk's

diff --git a/editeng/util/makefile.mk b/editeng/util/makefile.mk
deleted file mode 100644
index 80c8939..0000000
--- a/editeng/util/makefile.mk
+++ /dev/null
@@ -1,98 +0,0 @@
-#*************************************************************************
-#
-# 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
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=..
-
-PRJNAME=editeng
-TARGET=editeng
-GEN_HID=TRUE
-GEN_HID_OTHER=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE :  settings.mk
-
-# -------------
-
-HELPIDFILES=    ..$/inc$/helpid.hrc
-
-# editeng
-SHL1TARGET= editeng$(DLLPOSTFIX)
-SHL1IMPLIB= iediteng
-SHL1USE_EXPORTS=name
-SHL1LIBS= \
-    $(SLB)$/items.lib     \
-    $(SLB)$/misc.lib	\
-    $(SLB)$/rtf.lib	\
-    $(SLB)$/uno.lib	\
-    $(SLB)$/accessibility.lib	\
-    $(SLB)$/editeng.lib \
-    $(SLB)$/outliner.lib \
-    $(SLB)$/xml.lib
-
-SHL1STDLIBS= \
-             $(XMLOFFLIB) \
-             $(BASEGFXLIB) \
-             $(LNGLIB) \
-             $(SVTOOLLIB) \
-             $(TKLIB) \
-             $(VCLLIB) \
-             $(SVLLIB) \
-             $(SOTLIB) \
-             $(UNOTOOLSLIB) \
-             $(TOOLSLIB) \
-             $(I18NISOLANGLIB) \
-             $(I18NPAPERLIB) \
-             $(COMPHELPERLIB) \
-             $(UCBHELPERLIB) \
-             $(CPPUHELPERLIB) \
-             $(CPPULIB) \
-             $(SALLIB) \
-             $(SALHELPERLIB) \
-             $(ICUUCLIB)
-
-SHL1DEF=	$(MISC)$/$(SHL1TARGET).def
-DEF1NAME=	$(SHL1TARGET)
-DEFLIB1NAME=$(TARGET)
-
-# ------------------------------------------------------------------------------
-
-# Resource files
-SRSFILELIST=\
-        $(SRS)$/editeng.srs \
-        $(SRS)$/outliner.srs \
-        $(SRS)$/misc.srs \
-        $(SRS)$/items.srs
-
-RESLIB1NAME=editeng
-RESLIB1IMAGES=$(PRJ)$/res $(PRJ)$/source/svdraw
-RESLIB1SRSFILES= $(SRSFILELIST)
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE :  target.mk
-
diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk
deleted file mode 100755
index 2e756b5..0000000
--- a/svx/util/makefile.mk
+++ /dev/null
@@ -1,197 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=..
-
-PRJNAME=svx
-TARGET=svx
-GEN_HID=TRUE
-GEN_HID_OTHER=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE :  settings.mk
-
-RSCLOCINC+=-I$(PRJ)$/source$/svdraw
-
-HELPIDFILES=    ..$/inc$/helpid.hrc
-
-# svxcore
-SHL1TARGET= svxcore$(DLLPOSTFIX)
-SHL1IMPLIB= isvxcore
-SHL1USE_EXPORTS=name
-
-SHL1OBJS= \
-    $(SLO)$/coreservices.obj
-
-
-SHL1LIBS= \
-    $(SLB)$/animation.lib \
-    $(SLB)$/attribute.lib \
-    $(SLB)$/contact.lib \
-    $(SLB)$/customshapes-core.lib \
-    $(SLB)$/dialogs-core.lib \
-    $(SLB)$/engine3d-core.lib \
-    $(SLB)$/event.lib \
-    $(SLB)$/fmcomp-core.lib \
-    $(SLB)$/form-core.lib \
-    $(SLB)$/gal.lib \
-    $(SLB)$/items-core.lib \
-    $(SLB)$/overlay.lib \
-    $(SLB)$/primitive2d.lib \
-    $(SLB)$/primitive3d.lib \
-    $(SLB)$/properties.lib \
-    $(SLB)$/svdraw-core.lib \
-    $(SLB)$/table-core.lib \
-    $(SLB)$/tbxctrls-core.lib \
-    $(SLB)$/toolbars.lib \
-    $(SLB)$/unodraw-core.lib \
-    $(SLB)$/xml.lib \
-    $(SLB)$/xout.lib
-
-
-SHL1STDLIBS= \
-             $(EDITENGLIB) \
-             $(AVMEDIALIB) \
-             $(SFX2LIB) \
-             $(XMLOFFLIB) \
-             $(BASEGFXLIB) \
-             $(DRAWINGLAYERLIB) \
-             $(LNGLIB) \
-             $(BASICLIB) \
-             $(SVTOOLLIB) \
-             $(TKLIB) \
-             $(VCLLIB) \
-             $(SVLLIB) \
-             $(SOTLIB) \
-             $(UNOTOOLSLIB) \
-             $(TOOLSLIB) \
-             $(I18NISOLANGLIB) \
-             $(I18NPAPERLIB) \
-             $(COMPHELPERLIB) \
-             $(UCBHELPERLIB) \
-             $(CPPUHELPERLIB) \
-             $(CPPULIB) \
-             $(SALLIB) \
-             $(ICUUCLIB)
-
-SHL1DEF=	$(MISC)$/$(SHL1TARGET).def
-DEF1NAME=	$(SHL1TARGET)
-DEFLIB1NAME=$(SHL1LIBS:b)
-
-# svx
-SHL2TARGET= svx$(DLLPOSTFIX)
-SHL2IMPLIB= i$(TARGET)
-SHL2USE_EXPORTS=name
-SHL2DEPN=$(SHL1TARGETN)
-
-SHL2LIBS= \
-    $(SLB)$/svdraw.lib \
-    $(SLB)$/form.lib \
-    $(SLB)$/items.lib     \
-    $(SLB)$/dialogs.lib	\
-    $(SLB)$/mnuctrls.lib  \
-    $(SLB)$/stbctrls.lib  \
-    $(SLB)$/tbxctrls.lib  \
-    $(SLB)$/smarttags.lib \
-    $(SLB)$/unodraw.lib	\
-    $(SLB)$/unogallery.lib\
-    $(SLB)$/accessibility.lib	\
-    $(SLB)$/customshapes.lib \
-    $(SLB)$/fmcomp.lib \
-    $(SLB)$/engine3d.lib \
-    $(SLB)$/table.lib
-
-.IF "(GUIBASE)" == "WIN"
-SHL2LIBS+=$(SLB)$/ibrwimp.lib
-.ENDIF # (WIN)
-
-SHL2STDLIBS= \
-            $(EDITENGLIB) \
-            $(SVXCORELIB) \
-            $(SFX2LIB) \
-            $(XMLOFFLIB) \
-            $(BASEGFXLIB) \
-            $(DRAWINGLAYERLIB) \
-            $(BASICLIB) \
-            $(SVTOOLLIB) \
-            $(TKLIB) \
-            $(VCLLIB) \
-            $(SVLLIB) \
-            $(SOTLIB) \
-            $(UNOTOOLSLIB) \
-            $(TOOLSLIB) \
-            $(I18NISOLANGLIB) \
-            $(XMLSCRIPTLIB) \
-            $(COMPHELPERLIB) \
-            $(UCBHELPERLIB)	\
-            $(CPPUHELPERLIB)	\
-            $(CPPULIB) \
-            $(SALLIB) \
-            $(SALHELPERLIB) \
-            $(ICUUCLIB)
-
-.IF "$(GUI)"=="WNT"
-SHL2STDLIBS+=$(SHELLLIB)
-.ENDIF # WNT
-
-SHL2DEF=	$(MISC)$/$(SHL2TARGET).def
-DEF2NAME=	$(SHL2TARGET)
-DEFLIB2NAME=$(SHL2LIBS:b)
-
-.IF "$(debug)$(dbgutil)"!=""
-SHL2STDLIBS += $(CPPUHELPERLIB)
-.ENDIF # "$(debug)$(dbgutil)"!=""
-
-# ------------------------------------------------------------------------------
-
-# Resource files
-SRSFILELIST=\
-        $(SRS)$/svdstr.srs \
-        $(SRS)$/dialogs.srs \
-        $(SRS)$/drawdlgs.srs \
-        $(SRS)$/mnuctrls.srs \
-        $(SRS)$/stbctrls.srs \
-        $(SRS)$/tbxctrls.srs \
-        $(SRS)$/svxitems.srs \
-        $(SRS)$/form.srs \
-        $(SRS)$/fmcomp.srs \
-        $(SRS)$/engine3d.srs \
-        $(SRS)$/unodraw.srs \
-        $(SRS)$/accessibility.srs \
-        $(SRS)$/table.srs \
-        $(SRS)$/toolbars.srs \
-        $(SOLARCOMMONRESDIR)$/sfx.srs
-
-RESLIB1NAME=svx
-RESLIB1IMAGES=$(PRJ)$/res $(PRJ)$/source/svdraw
-RESLIB1SRSFILES= $(SRSFILELIST)
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE :  target.mk
-
commit 5b395625901b1f9c2314a0b9a13f4876a3ae17ce
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 7 23:50:19 2012 +0000

    de-uno-ize ScriptTypeDetector
    
    leave a UnoScriptTypeDetector implementation that points to the
    trivial ScriptTypeDetector for external consumers, e.g. sdext

diff --git a/i18npool/Library_i18npool.mk b/i18npool/Library_i18npool.mk
index 3faaa6a..9b56c5c 100644
--- a/i18npool/Library_i18npool.mk
+++ b/i18npool/Library_i18npool.mk
@@ -79,7 +79,7 @@ $(eval $(call gb_Library_add_exception_objects,i18npool,\
 	i18npool/source/characterclassification/cclass_unicode \
 	i18npool/source/characterclassification/cclass_unicode_parser \
 	i18npool/source/characterclassification/characterclassificationImpl \
-	i18npool/source/characterclassification/scripttypedetector \
+	i18npool/source/characterclassification/unoscripttypedetector \
 	i18npool/source/collator/chaptercollator \
 	i18npool/source/collator/collatorImpl \
 	i18npool/source/collator/collator_unicode \
diff --git a/i18npool/inc/scripttypedetector.hxx b/i18npool/inc/scripttypedetector.hxx
deleted file mode 100644
index 301dd6d..0000000
--- a/i18npool/inc/scripttypedetector.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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 _I18N_SCRIPTTYPEDETECTOR_HXX_
-#define _I18N_SCRIPTTYPEDETECTOR_HXX_
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-
-#include <com/sun/star/i18n/XScriptTypeDetector.hpp>
-#include <cppuhelper/implbase2.hxx> // helper for implementations
-
-//  ----------------------------------------------------
-//  class ScriptTypeDetector
-//  ----------------------------------------------------
-class ScriptTypeDetector : public cppu::WeakImplHelper2
-<
-    ::com::sun::star::i18n::XScriptTypeDetector,
-    ::com::sun::star::lang::XServiceInfo
->
-{
-public:
-    ScriptTypeDetector();
-    virtual ~ScriptTypeDetector();
-
-    // Methods
-    virtual sal_Int32 SAL_CALL beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ) throw (::com::sun::star::uno::RuntimeException);
-    virtual sal_Int32 SAL_CALL endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ) throw (::com::sun::star::uno::RuntimeException);
-    virtual sal_Int16 SAL_CALL getScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ) throw (::com::sun::star::uno::RuntimeException);
-    virtual sal_Int32 SAL_CALL beginOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException);
-    virtual sal_Int32 SAL_CALL endOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException);
-    virtual sal_Int16 SAL_CALL getCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException);
-
-
-    //XServiceInfo
-    virtual rtl::OUString SAL_CALL getImplementationName(void)
-                throw( ::com::sun::star::uno::RuntimeException );
-    virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
-                throw( ::com::sun::star::uno::RuntimeException );
-    virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
-                throw( ::com::sun::star::uno::RuntimeException );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/i18npool/inc/unoscripttypedetector.hxx b/i18npool/inc/unoscripttypedetector.hxx
new file mode 100644
index 0000000..ce06105
--- /dev/null
+++ b/i18npool/inc/unoscripttypedetector.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _I18N_UNOSCRIPTTYPEDETECTOR_HXX_
+#define _I18N_UNOSCRIPTTYPEDETECTOR_HXX_
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <com/sun/star/i18n/XScriptTypeDetector.hpp>
+#include <cppuhelper/implbase2.hxx> // helper for implementations
+
+//  ----------------------------------------------------
+//  class UnoScriptTypeDetector
+//  ----------------------------------------------------
+class UnoScriptTypeDetector : public cppu::WeakImplHelper2
+<
+    ::com::sun::star::i18n::XScriptTypeDetector,
+    ::com::sun::star::lang::XServiceInfo
+>
+{
+public:
+    // Methods
+    virtual sal_Int32 SAL_CALL beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int16 SAL_CALL getScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL beginOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL endOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int16 SAL_CALL getCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException);
+
+
+    //XServiceInfo
+    virtual rtl::OUString SAL_CALL getImplementationName(void)
+                throw( ::com::sun::star::uno::RuntimeException );
+    virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
+                throw( ::com::sun::star::uno::RuntimeException );
+    virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
+                throw( ::com::sun::star::uno::RuntimeException );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/i18npool/source/characterclassification/scripttypedetector.cxx b/i18npool/source/characterclassification/scripttypedetector.cxx
deleted file mode 100644
index 28f5165..0000000
--- a/i18npool/source/characterclassification/scripttypedetector.cxx
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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.
- *
- ************************************************************************/
-
-
-#include <com/sun/star/i18n/CTLScriptType.hpp>
-#include <com/sun/star/i18n/ScriptDirection.hpp>
-#include <com/sun/star/i18n/UnicodeScript.hpp>
-#include <scripttypedetector.hxx>
-#include <i18nutil/unicode.hxx>
-
-//      ----------------------------------------------------
-//      class ScriptTypeDetector
-//      ----------------------------------------------------;
-
-using namespace com::sun::star::i18n;
-
-ScriptTypeDetector::ScriptTypeDetector()
-{
-}
-
-ScriptTypeDetector::~ScriptTypeDetector()
-{
-}
-
-static sal_Int16 scriptDirection[] = {
-    ScriptDirection::LEFT_TO_RIGHT,     // DirectionProperty_LEFT_TO_RIGHT = 0,
-    ScriptDirection::RIGHT_TO_LEFT,     // DirectionProperty_RIGHT_TO_LEFT = 1,
-    ScriptDirection::LEFT_TO_RIGHT,     // DirectionProperty_EUROPEAN_NUMBER = 2,
-    ScriptDirection::LEFT_TO_RIGHT,     // DirectionProperty_EUROPEAN_NUMBER_SEPARATOR = 3,
-    ScriptDirection::LEFT_TO_RIGHT,     // DirectionProperty_EUROPEAN_NUMBER_TERMINATOR = 4,
-    ScriptDirection::RIGHT_TO_LEFT,     // DirectionProperty_ARABIC_NUMBER = 5,
-    ScriptDirection::NEUTRAL,           // DirectionProperty_COMMON_NUMBER_SEPARATOR = 6,
-    ScriptDirection::NEUTRAL,           // DirectionProperty_BLOCK_SEPARATOR = 7,
-    ScriptDirection::NEUTRAL,           // DirectionProperty_SEGMENT_SEPARATOR = 8,
-    ScriptDirection::NEUTRAL,           // DirectionProperty_WHITE_SPACE_NEUTRAL = 9,
-    ScriptDirection::NEUTRAL,           // DirectionProperty_OTHER_NEUTRAL = 10,
-    ScriptDirection::LEFT_TO_RIGHT,     // DirectionProperty_LEFT_TO_RIGHT_EMBEDDING = 11,
-    ScriptDirection::LEFT_TO_RIGHT,     // DirectionProperty_LEFT_TO_RIGHT_OVERRIDE = 12,
-    ScriptDirection::RIGHT_TO_LEFT,     // DirectionProperty_RIGHT_TO_LEFT_ARABIC = 13,
-    ScriptDirection::RIGHT_TO_LEFT,     // DirectionProperty_RIGHT_TO_LEFT_EMBEDDING = 14,
-    ScriptDirection::RIGHT_TO_LEFT,     // DirectionProperty_RIGHT_TO_LEFT_OVERRIDE = 15,
-    ScriptDirection::NEUTRAL,           // DirectionProperty_POP_DIRECTIONAL_FORMAT = 16,
-    ScriptDirection::NEUTRAL,           // DirectionProperty_DIR_NON_SPACING_MARK = 17,
-    ScriptDirection::NEUTRAL,           // DirectionProperty_BOUNDARY_NEUTRAL = 18,
-};
-
-sal_Int16 SAL_CALL
-ScriptTypeDetector::getScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ) throw (::com::sun::star::uno::RuntimeException)
-{
-    sal_Int16 dir = scriptDirection[unicode::getUnicodeDirection(Text[nPos])];
-    return (dir == ScriptDirection::NEUTRAL) ? defaultScriptDirection : dir;
-}
-
-// return value '-1' means either the direction on nPos is not same as scriptDirection or nPos is out of range.
-sal_Int32 SAL_CALL
-ScriptTypeDetector::beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction ) throw (::com::sun::star::uno::RuntimeException)
-{
-        sal_Int32 cPos = nPos;
-
-        if (cPos < Text.getLength()) {
-            for (; cPos >= 0; cPos--) {
-                if (direction != getScriptDirection(Text, cPos, direction))

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list