+#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
+#if TARGET_CARBON
+#else
+ (**(THPrint)m_printData.m_macPrintSettings).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt );
+ (**(THPrint)m_printData.m_macPrintSettings).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt );
+
+ (**(THPrint)m_printData.m_macPrintSettings).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt );
+ (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt );
+
+ (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.left = 0;
+ (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.top = 0;
+ (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt );
+ (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt );
+#endif
+}
+
+void wxPageSetupDialogData::ConvertFromNative()
+{
+ m_printData.ConvertFromNative ();
+
+#if TARGET_CARBON
+ PMRect rPaper;
+
+ OSStatus err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
+ if ( err == noErr )
+ {
+ m_paperSize.x = (int)(((double) rPaper.right - rPaper.left ) * pt2mm);
+ m_paperSize.y = (int)(((double) rPaper.bottom - rPaper.top ) * pt2mm);
+
+ m_minMarginTopLeft.x = (int)(((double) - rPaper.left ) * pt2mm);
+ m_minMarginTopLeft.y = (int)(((double) - rPaper.top ) * pt2mm);
+
+// m_minMarginBottomRight.x = ((double) rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.right ) * pt2mm;
+// m_minMarginBottomRight.y = ((double)(**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.bottom ) * pt2mm;
+ }
+#else
+ m_paperSize.x = ((double) (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ) * pt2mm;
+ m_paperSize.y = ((double) (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ) * pt2mm;
+
+ m_minMarginTopLeft.x = ((double) -(**(THPrint)m_printData.m_macPrintSettings).rPaper.left ) * pt2mm;
+ m_minMarginTopLeft.y = ((double) -(**(THPrint)m_printData.m_macPrintSettings).rPaper.top ) * pt2mm;
+
+ m_minMarginBottomRight.x = ((double) (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.right ) * pt2mm;
+ m_minMarginBottomRight.y = ((double)(**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).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
+
+