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