+#ifdef __WXMAC__
+void wxPageSetupDialogData::ConvertToNative()
+{
+ m_printData.ConvertToNative();
+ // on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0
+#ifdef TARGET_CARBON
+#else
+ (**m_printData.m_macPrintInfo).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt );
+ (**m_printData.m_macPrintInfo).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt );
+
+ (**m_printData.m_macPrintInfo).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt );
+ (**m_printData.m_macPrintInfo).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt );
+
+ (**m_printData.m_macPrintInfo).prInfo.rPage.left = 0;
+ (**m_printData.m_macPrintInfo).prInfo.rPage.top = 0;
+ (**m_printData.m_macPrintInfo).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt );
+ (**m_printData.m_macPrintInfo).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt );
+#endif
+}
+
+void wxPageSetupDialogData::ConvertFromNative()
+{
+ m_printData.ConvertFromNative ();
+
+#ifdef TARGET_CARBON
+#else
+ m_paperSize.x = ((double) (**m_printData.m_macPrintInfo).rPaper.right - (**m_printData.m_macPrintInfo).rPaper.left ) * pt2mm;
+ m_paperSize.y = ((double) (**m_printData.m_macPrintInfo).rPaper.bottom - (**m_printData.m_macPrintInfo).rPaper.top ) * pt2mm;
+
+ m_minMarginTopLeft.x = ((double) -(**m_printData.m_macPrintInfo).rPaper.left ) * pt2mm;
+ m_minMarginTopLeft.y = ((double) -(**m_printData.m_macPrintInfo).rPaper.top ) * pt2mm;
+
+ m_minMarginBottomRight.x = ((double) (**m_printData.m_macPrintInfo).rPaper.right - (**m_printData.m_macPrintInfo).prInfo.rPage.right ) * pt2mm;
+ m_minMarginBottomRight.y = ((double)(**m_printData.m_macPrintInfo).rPaper.bottom - (**m_printData.m_macPrintInfo).prInfo.rPage.bottom ) * pt2mm;
+#endif
+ // adjust minimal values
+ //TODO add custom fields in dialog for margins
+
+ if ( m_marginTopLeft.x < m_minMarginTopLeft.x )
+ m_marginTopLeft.x = m_minMarginTopLeft.x;
+
+ if ( m_marginBottomRight.x < m_minMarginBottomRight.x )
+ m_marginBottomRight.x = m_minMarginBottomRight.x;
+
+ if ( m_marginTopLeft.y < m_minMarginTopLeft.y )
+ m_marginTopLeft.y = m_minMarginTopLeft.y;
+
+ if ( m_marginBottomRight.y < m_minMarginBottomRight.y )
+ m_marginBottomRight.y = m_minMarginBottomRight.y;
+}
+#endif
+
+