summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorAbhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom>2010-07-01 10:06:56 +0000
committerAbhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom>2010-07-01 10:06:56 +0000
commit121815791be2d24cb745663520b111ee914fbc09 (patch)
tree487c6c27a31e9adbd81ad42f5a8eafef31547426 /src/ui
parentThis is the first c++ification commit from me. It handles sp-line, sp-polylin... (diff)
downloadinkscape-121815791be2d24cb745663520b111ee914fbc09.tar.gz
inkscape-121815791be2d24cb745663520b111ee914fbc09.zip
C++fied SPDocument added
(bzr r9546.1.2)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/clipboard.cpp6
-rw-r--r--src/ui/dialog/aboutbox.cpp8
-rw-r--r--src/ui/dialog/align-and-distribute.cpp8
-rw-r--r--src/ui/dialog/document-properties.cpp16
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp4
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp8
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp5
-rw-r--r--src/ui/dialog/print.cpp8
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp2
-rw-r--r--src/ui/dialog/swatches.cpp10
-rw-r--r--src/ui/dialog/tile.cpp2
-rw-r--r--src/ui/tool/node-tool.cpp3
-rw-r--r--src/ui/view/edit-widget.cpp8
-rw-r--r--src/ui/widget/imageicon.cpp4
-rw-r--r--src/ui/widget/page-sizer.cpp6
15 files changed, 48 insertions, 50 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index d92d35ae1..aa59a7b23 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -851,7 +851,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDesktop *desktop, SPDocument *clipdo
sp_selection_apply_affine(selection, desktop->dt2doc() * doc2parent * desktop->doc2dt(), true, false);
// Update (among other things) all curves in paths, for bounds() to work
- sp_document_ensure_up_to_date(target_document);
+ target_document->ensure_up_to_date();
// move selection either to original position (in_place) or to mouse pointer
Geom::OptRect sel_bbox = selection->bounds();
@@ -1200,7 +1200,7 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/)
guint32 bgcolor = 0x00000000;
Geom::Point origin (SP_ROOT(_clipboardSPDoc->root)->x.computed, SP_ROOT(_clipboardSPDoc->root)->y.computed);
- Geom::Rect area = Geom::Rect(origin, origin + sp_document_dimensions(_clipboardSPDoc));
+ Geom::Rect area = Geom::Rect(origin, origin + _clipboardSPDoc->getDimensions());
unsigned long int width = (unsigned long int) (area.width() * dpi / PX_PER_IN + 0.5);
unsigned long int height = (unsigned long int) (area.height() * dpi / PX_PER_IN + 0.5);
@@ -1254,7 +1254,7 @@ void ClipboardManagerImpl::_onClear()
void ClipboardManagerImpl::_createInternalClipboard()
{
if ( _clipboardSPDoc == NULL ) {
- _clipboardSPDoc = SPDocument::createDoc(NULL, false, true);
+ _clipboardSPDoc = SPDocument::createNewDoc(NULL, false, true);
//g_assert( _clipboardSPDoc != NULL );
_defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(_clipboardSPDoc));
_doc = sp_document_repr_doc(_clipboardSPDoc);
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index 7ed00ad19..8c102b57f 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -147,7 +147,7 @@ Gtk::Widget *build_splash_widget() {
// should be in UTF-*8..
char *about=g_build_filename(INKSCAPE_SCREENSDIR, _("about.svg"), NULL);
- SPDocument *doc=SPDocument::createDoc (about, TRUE);
+ SPDocument *doc=SPDocument::createNewDoc (about, TRUE);
g_free(about);
g_return_val_if_fail(doc != NULL, NULL);
@@ -155,12 +155,12 @@ Gtk::Widget *build_splash_widget() {
if ( version && SP_IS_TEXT(version) ) {
sp_te_set_repr_text_multiline (SP_TEXT (version), Inkscape::version_string);
}
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
GtkWidget *v=sp_svg_view_widget_new(doc);
- double width=sp_document_width(doc);
- double height=sp_document_height(doc);
+ double width=doc->getWidth();
+ double height=doc->getHeight();
doc->doUnref();
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index d7e3d1766..0b47f42ab 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -163,8 +163,8 @@ private :
}
case AlignAndDistribute::PAGE:
- mp = Geom::Point(a.mx1 * sp_document_width(sp_desktop_document(desktop)),
- a.my1 * sp_document_height(sp_desktop_document(desktop)));
+ mp = Geom::Point(a.mx1 * sp_desktop_document(desktop)->getWidth(),
+ a.my1 * sp_desktop_document(desktop)->getHeight());
break;
case AlignAndDistribute::DRAWING:
@@ -215,7 +215,7 @@ private :
it != selected.end();
it++)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
+ sp_desktop_document (desktop)->ensure_up_to_date();
if (!sel_as_group)
b = (*it)->getBboxDesktop();
if (b) {
@@ -621,7 +621,7 @@ private :
it != selected.end();
++it)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
+ sp_desktop_document (desktop)->ensure_up_to_date();
Geom::OptRect item_box = (*it)->getBboxDesktop ();
if (item_box) {
// find new center, staying within bbox
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 33fdf8327..970c609af 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -460,7 +460,7 @@ void
DocumentProperties::populate_linked_profiles_box()
{
_LinkedProfilesListStore->clear();
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
if (current) _emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
@@ -517,7 +517,7 @@ void DocumentProperties::removeSelectedProfile(){
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
@@ -589,7 +589,7 @@ DocumentProperties::build_cms()
_LinkedProfilesList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::linked_profiles_list_button_release));
cms_create_popup_menu(_LinkedProfilesList, sigc::mem_fun(*this, &DocumentProperties::removeSelectedProfile));
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "defs" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "defs" );
if (current) {
_emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
}
@@ -647,7 +647,7 @@ DocumentProperties::build_scripting()
#endif // ENABLE_LCMS
//TODO: review this observers code:
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
if (current) {
_ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
}
@@ -686,7 +686,7 @@ void DocumentProperties::removeExternalScript(){
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
SPScript* script = (SPScript*) obj;
@@ -703,7 +703,7 @@ void DocumentProperties::removeExternalScript(){
void DocumentProperties::populate_external_scripts_box(){
_ExternalScriptsListStore->clear();
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
if (current) _ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
@@ -822,8 +822,8 @@ DocumentProperties::update()
if (nv->doc_units)
_rum_deflt.setUnit (nv->doc_units);
- double const doc_w_px = sp_document_width(sp_desktop_document(dt));
- double const doc_h_px = sp_document_height(sp_desktop_document(dt));
+ double const doc_w_px = sp_desktop_document(dt)->getWidth();
+ double const doc_h_px = sp_desktop_document(dt)->getHeight();
_page_sizer.setDim (doc_w_px, doc_h_px);
_page_sizer.updateFitMarginsUI(SP_OBJECT_REPR(nv));
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index eb2d33eee..5a9f37bf0 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -151,7 +151,7 @@ bool SVGPreview::setFileName(Glib::ustring &theFileName)
* I don't know why passing false to keepalive is bad. But it
* prevents the display of an svg with a non-ascii filename
*/
- SPDocument *doc = SPDocument::createDoc (fileName.c_str(), true);
+ SPDocument *doc = SPDocument::createNewDoc (fileName.c_str(), true);
if (!doc) {
g_warning("SVGView: error loading document '%s'\n", fileName.c_str());
return false;
@@ -172,7 +172,7 @@ bool SVGPreview::setFromMem(char const *xmlBuffer)
return false;
gint len = (gint)strlen(xmlBuffer);
- SPDocument *doc = SPDocument::createDocFromMem(xmlBuffer, len, 0);
+ SPDocument *doc = SPDocument::createNewDocFromMem(xmlBuffer, len, 0);
if (!doc) {
g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer);
return false;
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 8a0c70f7c..aabb3c2df 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -887,7 +887,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
gchar *utf8string = g_utf16_to_utf8((const gunichar2*)_path_string,
_MAX_PATH, NULL, NULL, NULL);
- SPDocument *svgDoc = SPDocument::createDoc (utf8string, true);
+ SPDocument *svgDoc = SPDocument::createNewDoc (utf8string, true);
g_free(utf8string);
// Check the document loaded properly
@@ -899,8 +899,8 @@ bool FileOpenDialogImplWin32::set_svg_preview()
}
// Get the size of the document
- const double svgWidth = sp_document_width(svgDoc);
- const double svgHeight = sp_document_height(svgDoc);
+ const double svgWidth = svgDoc->getWidth();
+ const double svgHeight = svgDoc->getHeight();
// Find the minimum scale to fit the image inside the preview area
const double scaleFactorX = PreviewSize / svgWidth;
@@ -917,7 +917,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
// write object bbox to area
Geom::OptRect maybeArea(area);
- sp_document_ensure_up_to_date (svgDoc);
+ svgDoc->ensure_up_to_date ();
static_cast<(SPItem *)>(svgDoc->root)->invoke_bbox( maybeArea,
static_cast<(SPItem *)>(svgDoc->root)->i2d_affine(), TRUE);
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 1672c4b69..7baf2d71f 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -1144,8 +1144,7 @@ void FilterEffectsDialog::FilterModifier::on_activate_desktop(Application*, SPDe
me->_resource_changed.disconnect();
me->_resource_changed =
- sp_document_resources_changed_connect(sp_desktop_document(desktop), "filter",
- sigc::mem_fun(me, &FilterModifier::update_filters));
+ sp_desktop_document(desktop)->resources_changed_connect("filter",sigc::mem_fun(me, &FilterModifier::update_filters));
me->_dialog.setDesktop(desktop);
@@ -1262,7 +1261,7 @@ void FilterEffectsDialog::FilterModifier::update_filters()
{
SPDesktop* desktop = _dialog.getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* filters = sp_document_get_resource_list(document, "filter");
+ const GSList* filters = document->get_resource_list("filter");
_model->clear();
diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp
index 60cab06a2..808386171 100644
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
@@ -46,8 +46,8 @@ static void draw_page(
if (junk->_tab->as_bitmap()) {
// Render as exported PNG
- gdouble width = sp_document_width(junk->_doc);
- gdouble height = sp_document_height(junk->_doc);
+ gdouble width = (junk->_doc)->getWidth();
+ gdouble height = (junk->_doc)->getHeight();
gdouble dpi = junk->_tab->bitmap_dpi();
std::string tmp_png;
std::string tmp_base = "inkscape-print-png-XXXXXX";
@@ -190,8 +190,8 @@ Print::Print(SPDocument *doc, SPItem *base) :
// set up paper size to match the document size
gtk_print_operation_set_unit (_printop, GTK_UNIT_POINTS);
GtkPageSetup *page_setup = gtk_page_setup_new();
- gdouble doc_width = sp_document_width(_doc) * PT_PER_PX;
- gdouble doc_height = sp_document_height(_doc) * PT_PER_PX;
+ gdouble doc_width = _doc->getWidth() * PT_PER_PX;
+ gdouble doc_height = _doc->getHeight() * PT_PER_PX;
GtkPaperSize *paper_size;
if (doc_width > doc_height) {
gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_LANDSCAPE);
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 998f4e1e1..7f41c4d6b 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -243,7 +243,7 @@ void SvgFontsDialog::update_fonts()
{
SPDesktop* desktop = this->getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* fonts = sp_document_get_resource_list(document, "font");
+ const GSList* fonts = document->get_resource_list("font");
_model->clear();
for(const GSList *l = fonts; l; l = l->next) {
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 90e9e5f7b..d5d48a528 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -127,7 +127,7 @@ static void editGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ )
SPDocument *doc = desktop ? desktop->doc() : 0;
if (doc) {
std::string targetName(bounceTarget->def.descr);
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
+ const GSList *gradients = doc->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( targetName == grad->getId() ) {
@@ -178,7 +178,7 @@ void SwatchesPanelHook::convertGradient( GtkMenuItem * /*menuitem*/, gpointer us
if ( doc && (index >= 0) && (static_cast<guint>(index) < popupItems.size()) ) {
Glib::ustring targetName = popupItems[index];
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
+ const GSList *gradients = doc->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( targetName == grad->getId() ) {
@@ -306,7 +306,7 @@ gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, g
SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(wdgt);
if ( dtw && dtw->desktop ) {
// Pick up all gradients with vectors
- const GSList *gradients = sp_document_get_resource_list(dtw->desktop->doc(), "gradient");
+ const GSList *gradients = (dtw->desktop->doc())->get_resource_list("gradient");
gint index = 0;
for (const GSList *curr = gradients; curr; curr = curr->next) {
SPGradient* grad = SP_GRADIENT(curr->data);
@@ -759,7 +759,7 @@ void SwatchesPanel::_trackDocument( SwatchesPanel *panel, SPDocument *document )
}
docPerPanel[panel] = document;
if (!found) {
- sigc::connection conn1 = sp_document_resources_changed_connect( document, "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) );
+ sigc::connection conn1 = document->resources_changed_connect( "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) );
sigc::connection conn2 = SP_DOCUMENT_DEFS(document)->connectRelease( sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document)) );
sigc::connection conn3 = SP_DOCUMENT_DEFS(document)->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document))) );
@@ -797,7 +797,7 @@ static void recalcSwatchContents(SPDocument* doc,
{
std::vector<SPGradient*> newList;
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
+ const GSList *gradients = doc->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( grad->isSwatch() ) {
diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp
index dfb319f90..546fdd8f0 100644
--- a/src/ui/dialog/tile.cpp
+++ b/src/ui/dialog/tile.cpp
@@ -159,7 +159,7 @@ void TileDialog::Grid_Arrange ()
grid_top = 99999;
SPDesktop *desktop = getDesktop();
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
Inkscape::Selection *selection = sp_desktop_selection (desktop);
const GSList *items = selection ? selection->itemList() : 0;
diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp
index 570d53f05..d10f46313 100644
--- a/src/ui/tool/node-tool.cpp
+++ b/src/ui/tool/node-tool.cpp
@@ -593,8 +593,7 @@ void ink_node_tool_select_area(InkNodeTool *nt, Geom::Rect const &sel, GdkEventB
if (nt->_multipath->empty()) {
// if multipath is empty, select rubberbanded items rather than nodes
Inkscape::Selection *selection = nt->desktop->selection;
- GSList *items = sp_document_items_in_box(
- sp_desktop_document(nt->desktop), nt->desktop->dkey, sel);
+ GSList *items = sp_desktop_document(nt->desktop)->items_in_box(nt->desktop->dkey, sel);
selection->setList(items);
g_slist_free(items);
} else {
diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp
index 2c325a5ee..0248e73d5 100644
--- a/src/ui/view/edit-widget.cpp
+++ b/src/ui/view/edit-widget.cpp
@@ -1390,8 +1390,8 @@ EditWidget::updateScrollbars (double scale)
/* The desktop region we always show unconditionally */
SPDocument *doc = _desktop->doc();
- Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)),
- Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) );
+ Geom::Rect darea ( Geom::Point(-doc->getWidth(), -doc->getHeight()),
+ Geom::Point(2 * doc->getWidth(), 2 * doc->getHeight()) );
SPObject* root = doc->root;
SPItem* item = SP_ITEM(root);
Geom::OptRect deskarea = Geom::unify(darea, item->getBboxDesktop());
@@ -1654,12 +1654,12 @@ void
EditWidget::onWindowRealize()
{
- if ( (sp_document_width(_desktop->doc()) < 1.0) || (sp_document_height(_desktop->doc()) < 1.0) ) {
+ if ( ((_desktop->doc())->getWidth() < 1.0) || ((_desktop->doc())->getHeight() < 1.0) ) {
return;
}
Geom::Rect d( Geom::Point(0, 0),
- Geom::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())) );
+ Geom::Point((_desktop->doc())->getWidth(), (_desktop->doc())->getHeight()) );
_desktop->set_display_area(d.min()[Geom::X], d.min()[Geom::Y], d.max()[Geom::X], d.max()[Geom::Y], 10);
_namedview_modified(_desktop->namedview, SP_OBJECT_MODIFIED_FLAG);
diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp
index 79cc8ca42..f5dd3e9fa 100644
--- a/src/ui/widget/imageicon.cpp
+++ b/src/ui/widget/imageicon.cpp
@@ -127,7 +127,7 @@ bool ImageIcon::showSvgFile(const Glib::ustring &theFileName)
fileName = Glib::filename_to_utf8(fileName);
- SPDocument *doc = SPDocument::createDoc (fileName.c_str(), 0);
+ SPDocument *doc = SPDocument::createNewDoc (fileName.c_str(), 0);
if (!doc) {
g_warning("SVGView: error loading document '%s'\n", fileName.c_str());
return false;
@@ -148,7 +148,7 @@ bool ImageIcon::showSvgFromMemory(const char *xmlBuffer)
return false;
gint len = (gint)strlen(xmlBuffer);
- SPDocument *doc = SPDocument::createDocFromMem(xmlBuffer, len, 0);
+ SPDocument *doc = SPDocument::createNewDocFromMem(xmlBuffer, len, 0);
if (!doc) {
g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer);
return false;
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index 26763cc77..1f70a26fd 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -406,9 +406,9 @@ PageSizer::setDim (double w, double h, bool changeList)
if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) {
SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP);
- double const old_height = sp_document_height(doc);
- sp_document_set_width (doc, w, &_px_unit);
- sp_document_set_height (doc, h, &_px_unit);
+ double const old_height = doc->getHeight();
+ doc->setWidth (w, &_px_unit);
+ doc->setHeight (h, &_px_unit);
// The origin for the user is in the lower left corner; this point should remain stationary when
// changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this
Geom::Translate const vert_offset(Geom::Point(0, (old_height - h)));