+// ----------------------------------------------------------------------------
+// wxPageSetupDialogData
+// ----------------------------------------------------------------------------
+
+wxPageSetupDialogData::wxPageSetupDialogData()
+{
+ m_paperSize = wxSize(0,0);
+
+ CalculatePaperSizeFromId();
+
+ m_minMarginTopLeft =
+ m_minMarginBottomRight =
+ m_marginTopLeft =
+ m_marginBottomRight = wxPoint(0,0);
+
+ // Flags
+ m_defaultMinMargins = false;
+ m_enableMargins = true;
+ m_enableOrientation = true;
+ m_enablePaper = true;
+ m_enablePrinter = true;
+ m_enableHelp = false;
+ m_getDefaultInfo = false;
+}
+
+wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialogData)
+ : wxObject()
+{
+ (*this) = dialogData;
+}
+
+wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData& printData)
+{
+ m_paperSize = wxSize(0,0);
+ m_minMarginTopLeft =
+ m_minMarginBottomRight =
+ m_marginTopLeft =
+ m_marginBottomRight = wxPoint(0,0);
+
+ // Flags
+ m_defaultMinMargins = false;
+ m_enableMargins = true;
+ m_enableOrientation = true;
+ m_enablePaper = true;
+ m_enablePrinter = true;
+ m_enableHelp = false;
+ m_getDefaultInfo = false;
+
+ m_printData = printData;
+
+ // The wxPrintData paper size overrides these values, unless the size cannot
+ // be found.
+ CalculatePaperSizeFromId();
+}
+
+wxPageSetupDialogData::~wxPageSetupDialogData()
+{
+}
+
+wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPageSetupDialogData& data)
+{
+ m_paperSize = data.m_paperSize;
+ m_minMarginTopLeft = data.m_minMarginTopLeft;
+ m_minMarginBottomRight = data.m_minMarginBottomRight;
+ m_marginTopLeft = data.m_marginTopLeft;
+ m_marginBottomRight = data.m_marginBottomRight;
+ m_defaultMinMargins = data.m_defaultMinMargins;
+ m_enableMargins = data.m_enableMargins;
+ m_enableOrientation = data.m_enableOrientation;
+ m_enablePaper = data.m_enablePaper;
+ m_enablePrinter = data.m_enablePrinter;
+ m_getDefaultInfo = data.m_getDefaultInfo;
+ m_enableHelp = data.m_enableHelp;
+
+ m_printData = data.m_printData;
+
+ return *this;
+}
+
+wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPrintData& data)
+{
+ m_printData = data;
+ CalculatePaperSizeFromId();
+
+ return *this;
+}
+
+// If a corresponding paper type is found in the paper database, will set the m_printData
+// paper size id member as well.
+void wxPageSetupDialogData::SetPaperSize(const wxSize& sz)
+{
+ m_paperSize = sz;
+
+ CalculateIdFromPaperSize();
+}
+
+// Sets the wxPrintData id, plus the paper width/height if found in the paper database.
+void wxPageSetupDialogData::SetPaperSize(wxPaperSize id)
+{
+ m_printData.SetPaperId(id);
+
+ CalculatePaperSizeFromId();
+}
+
+void wxPageSetupDialogData::SetPrintData(const wxPrintData& printData)
+{
+ m_printData = printData;
+ CalculatePaperSizeFromId();
+}
+
+// Use paper size defined in this object to set the wxPrintData
+// paper id
+void wxPageSetupDialogData::CalculateIdFromPaperSize()
+{
+ wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
+ wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") );
+
+ wxSize sz = GetPaperSize();
+
+ wxPaperSize id = wxThePrintPaperDatabase->GetSize(wxSize(sz.x* 10, sz.y * 10));
+ if (id != wxPAPER_NONE)