curvirgoです。
Yoshiyuki Masutomi wrote:
> svx/source/items/paperinf.cxxの、ConvertTo100thMM()あたりを使って変換す
次のようにして動作を確認してみました。
Get100thMMというのがセンス無いですけど...
関連するかどうかわかりませんが、メニューからDrawを起動した場合と、一度
Drawのみを閉じて(Soffice自体は終了しないで)から新規作成でDrawを再度起動
すると、余白の数値が違いますね。
私の所では、前者が0.64、0.68、0.64、0.66(左右上下の順)ですが、後者の場合
0.35、0.36、0.31、0.53となります。
もともとの動作もそうなのだろうか...
Index: svx/inc/paperinf.hxx
===================================================================
RCS file: /cvs/graphics/svx/inc/paperinf.hxx,v
retrieving revision 1.4
diff -u -r1.4 paperinf.hxx
--- svx/inc/paperinf.hxx 8 Sep 2005 18:16:28 -0000 1.4
+++ svx/inc/paperinf.hxx 6 Feb 2006 23:06:51 -0000
@@ -51,29 +51,81 @@
#include "svx/svxdllapi.h"
#endif
+#include <map>
+#include <list>
+
// forward ---------------------------------------------------------------
class Printer;
class Size;
class String;
-// class SvxPaperInfo -----------------------------------------------------
+// class SvxPaper ----------------------------------------------------
+
+enum SvxPaperType
+{
+ SVX_PAPER_TYPE_STANDARD,
+ SVX_PAPER_TYPE_PRESENTATION
+};
+
+#define SVX_PAPER_OPTIONAL ((SvxPaper*)NULL)
+
+using namespace ::rtl;
+
+class SVX_DLLPUBLIC SvxPaper
+{
+private:
+ OUString msName;
+ Size maSize;
+ SvxPaperType meType;
+
+ SvxPaper(const OUString &rName,
+ const Size& rSize,
+ const SvxPaperType& rType = SVX_PAPER_TYPE_STANDARD);
+public:
+ ~SvxPaper();
+ OUString GetName() const;
+ Size GetSize() const ;
+ Size Get100thMM() const ;
+ SvxPaperType GetType() const;
+
+ BOOL Equal(const Size& rSize, MapUnit eUnit, BOOL bSloppy);
+
+ friend class SvxPaperInfo;
+};
+
+// class SvxPaperInfo ----------------------------------------------------
+
+typedef std::map< OUString, SvxPaper* > PaperMap;
+typedef std::list<SvxPaper*> PaperList;
class SVX_DLLPUBLIC SvxPaperInfo
{
+private:
+ static SvxPaperInfo* instance;
+
+protected:
+ PaperMap maPapers;
+ PaperList maStandardPaperList;
+ PaperList maDrawPaperList;
+ PaperList maEnvelopePaperList;
+ SvxPaper* maDefaultPaper;
+
public:
- static Size GetPaperSize( const Printer* );
- static Size GetPaperSize( SvxPaper ePaper,
-
MapUnit eUnit = MAP_TWIP );
- // entfaellt demnaechst
- static SvxPaper GetPaper( const Size&, MapUnit eUnit = MAP_TWIP,
- BOOL bSloppy
= FALSE );
- // dann nur noch diese beiden
- static SvxPaper GetSvxPaper( const Size&, MapUnit eUnit =
MAP_TWIP,
- BOOL
bSloppy = FALSE );
- static Paper GetSvPaper( const Size&, MapUnit eUnit =
MAP_TWIP,
- BOOL
bSloppy = FALSE );
- static String GetName( SvxPaper ePaper );
+ // singleton pattern
+ static SvxPaperInfo& Instance ();
+ SvxPaperInfo (const SvxPaperInfo& aHandler);
+ SvxPaperInfo& operator= (const SvxPaperInfo& aHandler);
+
+ /** This destructor is never called at the moment. But because this
+ class is a singleton this is not a problem.
+ */
+ virtual ~SvxPaperInfo ();
+
+ SvxPaperInfo ();
+
+ SvxPaper* GetDefaultPaper();
+ void GetIterator( SvxPaperCategory eCategory, PaperList::iterator&
start, PaperList::iterator& end );
};
// INLINE -----------------------------------------------------------------
Index: svx/source/items/paperinf.cxx
===================================================================
RCS file: /cvs/graphics/svx/source/items/paperinf.cxx,v
retrieving revision 1.5
diff -u -r1.5 paperinf.cxx
--- svx/source/items/paperinf.cxx 8 Sep 2005 23:38:32 -0000 1.5
+++ svx/source/items/paperinf.cxx 6 Feb 2006 23:06:58 -0000
@@ -57,54 +57,37 @@
#include "dialmgr.hxx"
#endif
-#define SVX_PAPER_OFFSET 3 // Anfang: enum Paper A3 - SvxPaper A0;
Diff=3
-// STATIC DATA -----------------------------------------------------------
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#ifndef _COM_SUN_STAR_CONTAINER_XCONTENTENUMERATIONACCESS_HPP_
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
+#include <com/sun/star/container/XSet.hpp>
+#endif
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::rtl;
-static Size __FAR_DATA aDinTab[] =
-{
- Size(lA0Width,lA0Height), // A0
- Size(lA1Width,lA1Height), // A1
- Size(lA2Width,lA2Height), // A2
- Size(lA3Width,lA3Height), // A3
- Size(lA4Width,lA4Height), // A4
- Size(lA5Width,lA5Height), // A5
- Size(lB4Width, lB4Height), // B4
- Size(lB5Width,lB5Height), // B5
- Size(lLetterWidth,lLetterHeight), // LETTER
- Size(lLegalWidth,lLegalHeight), // LEGAL
- Size(lTabloidWidth,lTabloidHeight), // TABLOID
- Size(0, 0), // USER
- Size(lB6Width, lB6Height), // B6
- Size(lC4Width, lC4Height), // C4
- Size(lC5Width, lC5Height), // C5
- Size(lC6Width, lC6Height), // C6
- Size(lC65Width, lC65Height), // C65
- Size(lDLWidth, lDLHeight), // DL
- Size(lDiaWidth,lDiaHeight ), // DIA
- Size(lScreenWidth, lScreenHeight), // SCREEN
- Size(lAWidth, lAHeight), // A
- Size(lBWidth, lBHeight), // B
- Size(lCWidth, lCHeight), // C
- Size(lDWidth, lDHeight), // D
- Size(lEWidth, lEHeight), // E
- Size(lExeWidth, lExeHeight), // Executive
- Size(lLegal2Width, lLegal2Height), // Legal2
- Size(lMonarchWidth, lMonarchHeight),// Monarch
- Size(lCom675Width, lCom675Height), // COM-6 3/4
- Size(lCom9Width, lCom9Height), // COM-9
- Size(lCom10Width, lCom10Height), // COM-10
- Size(lCom11Width, lCom11Height), // COM-11
- Size(lCom12Width, lCom12Height), // COM-12
- Size(lKai16Width, lKai16Height), // 16 kai
- Size(lKai32Width, lKai32Height), // 32 kai
- Size(lKai32BigWidth, lKai32BigHeight), // 32 kai gross
- Size(lJISB4Width, lJISB4Height), // B4 (JIS)
- Size(lJISB5Width, lJISB5Height), // B5 (JIS)
- Size(lJISB6Width, lJISB6Height) // B6 (JIS)
-};
-
-static const int nTabSize = sizeof(aDinTab) / sizeof(aDinTab[0]);
+//#include "mydebug.hxx"
// -----------------------------------------------------------------------
@@ -152,196 +135,275 @@
return rSize;
}
-// -----------------------------------------------------------------------
+// class SvxPaper --------------------------------------------------------
-SvxPaper GetPaper_Impl( const Size &rSize, MapUnit eUnit, BOOL bSloppy )
+SvxPaper::SvxPaper(const OUString &rName,
+ const Size &rSize,
+ const SvxPaperType& rType) :
+ msName(rName),
+ maSize(rSize),
+ meType(rType)
{
- DBG_ASSERT( eUnit == MAP_TWIP || eUnit == MAP_100TH_MM,
- "map unit not supported" );
- Size aSize = rSize;
+}
- if ( eUnit == MAP_100TH_MM )
- ConvertToTwips( aSize );
+// -----------------------------------------------------------------------
- for ( USHORT i = 0; i < nTabSize; i++ )
- {
- if ( aDinTab[i] == aSize )
- return (SvxPaper)i;
- else if ( bSloppy )
- {
- long lDiffW = Abs(aDinTab[i].Width () - aSize.Width ()),
- lDiffH = Abs(aDinTab[i].Height() -
aSize.Height());
+// destructor
- if ( lDiffW < 6 && lDiffH < 6 )
- return (SvxPaper)i;
- }
- }
- return SVX_PAPER_USER;
+SvxPaper::~SvxPaper()
+{
}
+// -----------------------------------------------------------------------
-/*--------------------------------------------------------------------
- Beschreibung: Ist der Printer gueltig
- --------------------------------------------------------------------*/
-
-inline BOOL IsValidPrinter( const Printer* pPtr )
+OUString SvxPaper::GetName() const
{
- return pPtr->GetName().Len() ? TRUE : FALSE;
+ return msName;
}
-/*------------------------------------------------------------------------
- Beschreibung: Konvertierung eines SV-Defines fuer Papiergroesse in
- Twips.
- Funktioniert logischerweise nicht fuer User
Groessen
- (ASSERT).
-------------------------------------------------------------------------*/
+// -----------------------------------------------------------------------
-Size SvxPaperInfo::GetPaperSize( SvxPaper ePaper, MapUnit eUnit )
+Size SvxPaper::GetSize() const
{
- DBG_ASSERT( ePaper < nTabSize, "Tabelle der Papiergroessen
ueberindiziert" );
- DBG_ASSERT( eUnit == MAP_TWIP || eUnit == MAP_100TH_MM, "this MapUnit
not supported" );
- Size aSize = aDinTab[ePaper]; // in Twips
+ return maSize;
+}
- if ( eUnit == MAP_100TH_MM )
- ConvertTo100thMM( aSize );
+// -----------------------------------------------------------------------
+
+Size SvxPaper::Get100thMM() const
+{
+ Size aSize = GetSize();
+ aSize = ConvertTo100thMM( aSize );
return aSize;
}
-/*------------------------------------------------------------------------
- Beschreibung: Papiergroesse der Druckers liefern, aligned auf
- die eigenen Groessen.
- Falls kein Printer im System eingestellt ist,
- wird DIN A4 Portrait als Defaultpapiergroesse
geliefert.
-------------------------------------------------------------------------*/
-
-Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter )
-{
- if ( !IsValidPrinter(pPrinter) )
- return GetPaperSize( SVX_PAPER_A4 );
- const SvxPaper ePaper = (SvxPaper)(pPrinter->GetPaper() +
SVX_PAPER_OFFSET);
+// -----------------------------------------------------------------------
+
+SvxPaperType SvxPaper::GetType() const
+{
+ return meType;
+}
+
+// -----------------------------------------------------------------------
- if ( ePaper == SVX_PAPER_USER )
+BOOL SvxPaper::Equal(const Size& rSize, MapUnit eUnit, BOOL bSloppy)
+{
+ DBG_ASSERT( eUnit == MAP_TWIP || eUnit == MAP_100TH_MM,
+ "map unit not supported" );
+ Size aSize = rSize;
+
+ if ( eUnit == MAP_100TH_MM )
+ ConvertToTwips( aSize );
+
+ if ( maSize == aSize )
+ return TRUE;
+ else if ( bSloppy )
{
- // Orientation nicht beruecksichtigen, da durch SV
bereits
- // die richtigen Masze eingestellt worden sind.
- Size aPaperSize = pPrinter->GetPaperSize();
- const Size aInvalidSize;
-
- if ( aPaperSize == aInvalidSize )
- return GetPaperSize(SVX_PAPER_A4);
- MapMode aMap1 = pPrinter->GetMapMode();
- MapMode aMap2;
-
- if ( aMap1 == aMap2 )
- aPaperSize =
- pPrinter->PixelToLogic( aPaperSize, MapMode(
MAP_TWIP ) );
- return aPaperSize;
+ long lDiffW = Abs(maSize.Width() - aSize.Width()),
+ lDiffH = Abs(maSize.Height() - aSize.Height());
+
+ if ( lDiffW < 6 && lDiffH < 6 )
+ return TRUE;
}
- const Orientation eOrient = pPrinter->GetOrientation();
- Size aSize( GetPaperSize( ePaper ) );
- // bei Landscape die Seiten tauschen, ist bei SV schon geschehen
- if ( eOrient == ORIENTATION_LANDSCAPE )
- Swap( aSize );
- return aSize;
+ return FALSE;
}
-/*------------------------------------------------------------------------
- Beschreibung: Konvertierung einer Papiergroesse in Twips in das
- SV-Define. Ist bSloppy TRUE, so wird nur auf
1/10 mm genau
- verglichen.
-------------------------------------------------------------------------*/
+// class SvxPaperInfo ----------------------------------------------------
+
+// the unique instance
-SvxPaper SvxPaperInfo::GetPaper( const Size &rSize, MapUnit eUnit, BOOL
bSloppy )
+SvxPaperInfo* SvxPaperInfo::instance = NULL;
+
+// -----------------------------------------------------------------------
+
+// the unique method to get SvxPaperInfo instance
+
+SvxPaperInfo& SvxPaperInfo::Instance(void)
+{
+ if (instance == NULL)
+ {
+ // Create the single instance of the shape type handler.
+ instance = new SvxPaperInfo;
+ }
+
+ return *instance;
+}
+
+// -----------------------------------------------------------------------
+
+SvxPaperInfo::SvxPaperInfo(const SvxPaperInfo& aHandler)
{
- return GetPaper_Impl( rSize, eUnit, bSloppy );
+ // Don't call this constructor. This class is a singleton.
+ OSL_ENSURE (sal_False, "Wrong (copy-) constructor of singleton
SvxPaperInfo called."
+ " Don't do that again.");
}
// -----------------------------------------------------------------------
-SvxPaper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit,
BOOL bSloppy )
+SvxPaperInfo::~SvxPaperInfo(void)
{
- return GetPaper_Impl( rSize, eUnit, bSloppy );
+ // Because this class is a singleton and the only instance, whose
+ // destructor has just been called, is pointed to from instance,
+ // we reset the static variable instance, so that further calls to
+ // getInstance do not return an undefined object but create a new
+ // singleton.
+ instance = NULL;
}
// -----------------------------------------------------------------------
-Paper SvxPaperInfo::GetSvPaper( const Size &rSize, MapUnit eUnit,
- BOOL bSloppy )
+SvxPaperInfo& SvxPaperInfo::operator= (const SvxPaperInfo& aHandler)
{
- Paper eRet = PAPER_USER;
- SvxPaper ePaper = GetPaper_Impl( rSize, eUnit, bSloppy );
+ // Don't call this operator. This class is a singleton.
+ OSL_ENSURE (sal_False, "Assignment operator of singleton
SvxPaperInfo called."
+ " Don't do that again.");
+ return *this;
+}
- switch ( ePaper )
+// -----------------------------------------------------------------------
+
+static const OUString sConfigSrvc =
OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider");
+static const OUString sAccessSrvc =
OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess");
+static const OUString sPaperPath =
OUString::createFromAscii("org.openoffice.Office.Common/Paper");
+static const OUString sPaperInfoPath =
OUString::createFromAscii("org.openoffice.Office.Common/Paper/PaperInfo");
+static const OUString sDefaultPaper =
OUString::createFromAscii("DefaultPaper");
+static const OUString sPaperName = OUString::createFromAscii("Name");
+static const OUString sPaperWidth = OUString::createFromAscii("Width");
+static const OUString sPaperHeight = OUString::createFromAscii("Height");
+static const OUString sPaperPresentation =
OUString::createFromAscii("Presentation");
+static const OUString sStandardPaperList =
OUString::createFromAscii("StandardPaperList");
+static const OUString sDrawPaperList =
OUString::createFromAscii("DrawPaperList");
+static const OUString sEnvelopePaperList =
OUString::createFromAscii("EnvelopePaperList");
+
+SvxPaperInfo::SvxPaperInfo()
+{
+ // read configuration
+ Reference< XMultiServiceFactory > theMSF =
comphelper::getProcessServiceFactory();
+ Reference< XMultiServiceFactory > theConfigProvider = Reference<
XMultiServiceFactory > (theMSF->createInstance( sConfigSrvc ),UNO_QUERY);
+ Sequence< Any > theArgs(1);
+ Reference< XNameAccess > theNameAccess;
+ Reference< XNameAccess > thePaperInfo;
+
+ // get all papers
+ theArgs[0] = makeAny(NamedValue(OUString::createFromAscii("NodePath"),
makeAny(sPaperInfoPath)));
+ theNameAccess = Reference< XNameAccess > (
+ theConfigProvider->createInstanceWithArguments(sAccessSrvc,
theArgs ), UNO_QUERY );
+
+ Sequence< OUString > seqPaperKeys = theNameAccess->getElementNames();
+
+ for (sal_Int32 i=0; i<seqPaperKeys.getLength(); i++)
{
- case SVX_PAPER_A3: eRet = PAPER_A3;
break;
- case SVX_PAPER_A4: eRet = PAPER_A4;
break;
- case SVX_PAPER_A5: eRet = PAPER_A5;
break;
- case SVX_PAPER_B4: eRet = PAPER_B4;
break;
- case SVX_PAPER_B5: eRet = PAPER_B5;
break;
- case SVX_PAPER_LETTER: eRet = PAPER_LETTER;
break;
- case SVX_PAPER_LEGAL: eRet = PAPER_LEGAL;
break;
- case SVX_PAPER_TABLOID: eRet = PAPER_TABLOID;
break;
+ OUString sName;
+ long nWidth, nHeight;
+ sal_Bool bPresentation;
+
+ thePaperInfo = Reference< XNameAccess >
(theNameAccess->getByName(
seqPaperKeys[i] ) , UNO_QUERY );
+
+ thePaperInfo->getByName(sPaperName) >>= sName;
+ thePaperInfo->getByName(sPaperWidth) >>= nWidth;
+ thePaperInfo->getByName(sPaperHeight) >>= nHeight;
+ thePaperInfo->getByName(sPaperPresentation) >>= bPresentation;
+
+ SvxPaperType rType = SVX_PAPER_TYPE_STANDARD;
+ if (bPresentation)
+ rType = SVX_PAPER_TYPE_PRESENTATION;
+
+ maPapers[ seqPaperKeys[i] ] = new SvxPaper( sName,
+
Size( nWidth , nHeight ),
+
rType );
}
-
- return eRet;
-}
-/*------------------------------------------------------------------------
- Beschreibung: String Repr"asentation f"ur die SV-Defines f"ur
- Papiergroessen.
-------------------------------------------------------------------------*/
+ theArgs[0] = makeAny(NamedValue(OUString::createFromAscii("NodePath"),
makeAny(sPaperPath)));
+ theNameAccess = Reference< XNameAccess > (
+ theConfigProvider->createInstanceWithArguments(sAccessSrvc,
theArgs ), UNO_QUERY );
-String SvxPaperInfo::GetName( SvxPaper ePaper )
-{
- USHORT nResId = 0;
+ // set default paper
+ if ( theNameAccess->hasByName( sDefaultPaper ) )
+ {
+ OUString sDefault;
+ theNameAccess->getByName( sDefaultPaper ) >>= sDefault;
+
+ PaperMap::iterator p;
+ p = maPapers.find( sDefault );
+ if( p != maPapers.end() )
+ maDefaultPaper = p->second;
+ else
+ maDefaultPaper = maPapers.begin()->second;
+ }
- switch ( ePaper )
+ // set standard paper list
+ if ( theNameAccess->hasByName( sStandardPaperList ) )
{
- case SVX_PAPER_A0: nResId =
RID_SVXSTR_PAPER_A0; break;
- case SVX_PAPER_A1: nResId =
RID_SVXSTR_PAPER_A1; break;
- case SVX_PAPER_A2: nResId =
RID_SVXSTR_PAPER_A2; break;
- case SVX_PAPER_A3: nResId =
RID_SVXSTR_PAPER_A3; break;
- case SVX_PAPER_A4: nResId =
RID_SVXSTR_PAPER_A4; break;
- case SVX_PAPER_A5: nResId =
RID_SVXSTR_PAPER_A5; break;
- case SVX_PAPER_B4: nResId =
RID_SVXSTR_PAPER_B4; break;
- case SVX_PAPER_B5: nResId =
RID_SVXSTR_PAPER_B5; break;
- case SVX_PAPER_LETTER: nResId =
RID_SVXSTR_PAPER_LETTER; break;
- case SVX_PAPER_LEGAL: nResId =
RID_SVXSTR_PAPER_LEGAL; break;
- case SVX_PAPER_TABLOID: nResId =
RID_SVXSTR_PAPER_TABLOID; break;
- case SVX_PAPER_USER: nResId = RID_SVXSTR_PAPER_USER;
break;
- case SVX_PAPER_B6: nResId =
RID_SVXSTR_PAPER_B6; break;
- case SVX_PAPER_C4: nResId =
RID_SVXSTR_PAPER_C4; break;
- case SVX_PAPER_C5: nResId =
RID_SVXSTR_PAPER_C5; break;
- case SVX_PAPER_C6: nResId =
RID_SVXSTR_PAPER_C6; break;
- case SVX_PAPER_C65: nResId = RID_SVXSTR_PAPER_C65;
break;
- case SVX_PAPER_DL: nResId =
RID_SVXSTR_PAPER_DL; break;
- case SVX_PAPER_DIA: nResId = RID_SVXSTR_PAPER_DIA;
break;
- case SVX_PAPER_SCREEN: nResId =
RID_SVXSTR_PAPER_SCREEN; break;
- case SVX_PAPER_A: nResId =
RID_SVXSTR_PAPER_A; break;
- case SVX_PAPER_B: nResId =
RID_SVXSTR_PAPER_B; break;
- case SVX_PAPER_C: nResId =
RID_SVXSTR_PAPER_C; break;
- case SVX_PAPER_D: nResId =
RID_SVXSTR_PAPER_D; break;
- case SVX_PAPER_E: nResId =
RID_SVXSTR_PAPER_E; break;
- case SVX_PAPER_EXECUTIVE: nResId =
RID_SVXSTR_PAPER_EXECUTIVE;break;
- case SVX_PAPER_LEGAL2: nResId =
RID_SVXSTR_PAPER_LEGAL2; break;
- case SVX_PAPER_MONARCH: nResId =
RID_SVXSTR_PAPER_MONARCH; break;
- case SVX_PAPER_COM675: nResId =
RID_SVXSTR_PAPER_COM675; break;
- case SVX_PAPER_COM9: nResId = RID_SVXSTR_PAPER_COM9;
break;
- case SVX_PAPER_COM10: nResId =
RID_SVXSTR_PAPER_COM10; break;
- case SVX_PAPER_COM11: nResId =
RID_SVXSTR_PAPER_COM11; break;
- case SVX_PAPER_COM12: nResId =
RID_SVXSTR_PAPER_COM12; break;
- case SVX_PAPER_KAI16: nResId =
RID_SVXSTR_PAPER_KAI16; break;
- case SVX_PAPER_KAI32: nResId =
RID_SVXSTR_PAPER_KAI32; break;
- case SVX_PAPER_KAI32BIG: nResId =
RID_SVXSTR_PAPER_KAI32BIG; break;
- case SVX_PAPER_B4_JIS: nResId =
RID_SVXSTR_PAPER_B4_JIS; break;
- case SVX_PAPER_B5_JIS: nResId =
RID_SVXSTR_PAPER_B5_JIS; break;
- case SVX_PAPER_B6_JIS: nResId =
RID_SVXSTR_PAPER_B6_JIS; break;
+ sal_Int32 nIndex = 0;
+ OUString sList;
+ theNameAccess->getByName( sStandardPaperList ) >>= sList;
- default: DBG_ERRORFILE( "unknown papersize" );
+ do
+ {
+ OUString sPaperKey = sList.getToken(0, ',', nIndex);
+ PaperMap::iterator p = maPapers.find( sPaperKey );
+ if( p != maPapers.end() )
+ maStandardPaperList.push_back( p->second );
+ }while( nIndex >= 0 );
+ }
+
+ // set draw paper list
+ if ( theNameAccess->hasByName( sDrawPaperList ) )
+ {
+ sal_Int32 nIndex = 0;
+ OUString sList;
+ theNameAccess->getByName( sDrawPaperList ) >>= sList;
+
+ do
+ {
+ OUString sPaperKey = sList.getToken(0, ',', nIndex);
+ PaperMap::iterator p = maPapers.find( sPaperKey );
+ if( p != maPapers.end() )
+ maDrawPaperList.push_back( p->second );
+ }while( nIndex >= 0 );
}
- return ( nResId > 0 ) ? String( SVX_RES( nResId ) ) : String();
+ // set envelope paper list
+ if ( theNameAccess->hasByName( sEnvelopePaperList ) )
+ {
+ sal_Int32 nIndex = 0;
+ OUString sList;
+ theNameAccess->getByName( sEnvelopePaperList ) >>= sList;
+
+ do
+ {
+ OUString sPaperKey = sList.getToken(0, ',', nIndex);
+ PaperMap::iterator p = maPapers.find( sPaperKey );
+ if( p != maPapers.end() )
+ maEnvelopePaperList.push_back( p->second );
+ }while( nIndex >= 0 );
+ }
}
+// -----------------------------------------------------------------------
+SvxPaper* SvxPaperInfo::GetDefaultPaper()
+{
+ return maDefaultPaper;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPaperInfo::GetIterator( SvxPaperCategory eCategory,
PaperList::iterator& start, PaperList::iterator& end )
+{
+ switch( eCategory ){
+ case SVX_PAPER_CATEGORY_STANDARD:
+ start = maStandardPaperList.begin();
+ end = maStandardPaperList.end();
+ break;
+ case SVX_PAPER_CATEGORY_DRAW:
+ start = maDrawPaperList.begin();
+ end = maDrawPaperList.end();
+ break;
+ case SVX_PAPER_CATEGORY_ENVELOPE:
+ start = maEnvelopePaperList.begin();
+ end = maEnvelopePaperList.end();
+ break;
+ }
+}
Index: sd/source/core/drawdoc2.cxx
===================================================================
RCS file: /cvs/graphics/sd/source/core/drawdoc2.cxx,v
retrieving revision 1.34
diff -u -r1.34 drawdoc2.cxx
--- sd/source/core/drawdoc2.cxx 10 Jan 2006 14:25:31 -0000 1.34
+++ sd/source/core/drawdoc2.cxx 6 Feb 2006 23:06:39 -0000
@@ -500,31 +500,17 @@
* Default-Papiergroesse vom Drucker holen
**********************************************************************/
SfxPrinter* pPrinter = NULL;
- Size aDefSize(21000, 29700); // A4-Hochformat
+ Size aDefSize =
SvxPaperInfo::Instance().GetDefaultPaper()->Get100thMM(); // A4-Hochformat
+
+ if(pDocSh){
+ pPrinter = pDocSh->GetPrinter(TRUE);
+ }
SdPage* pRefPage = 0;
if( pRefDocument )
SdPage* pRefHandout = pRefDocument->GetSdPage( 0,
PK_HANDOUT );
- if(pDocSh)
- {
- pPrinter = pDocSh->GetPrinter(TRUE);
-
- if (pPrinter->IsValid())
- {
- // Der Printer gibt leider kein exaktes Format
(z.B. A4) zurueck
- aDefSize = pPrinter->GetPaperSize();
- SvxPaper ePaper =
SvxPaperInfo::GetSvxPaper(aDefSize, MAP_100TH_MM,
TRUE);
-
- if (ePaper != SVX_PAPER_USER)
- {
- // Korrekte Size holen
- aDefSize =
SvxPaperInfo::GetPaperSize(ePaper, MAP_100TH_MM);
- }
- }
- }
-
/**********************************************************************
* Handzettel-Seite einfuegen
**********************************************************************/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]