r14924 by cbradney - First part of making the doc using prefs structs for prefs based data, add set/get functions for hyph functions, page sets, paper colour, etc

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 21 23:52:12 CET 2010


Revision: 14924
Author: cbradney
Date: 2010-03-21T22:48:44.810253Z
Commit message: First part of making the doc using prefs structs for prefs based data, add set/get functions for hyph functions, page sets, paper colour, etc

Changeset: 
M  /trunk/Scribus/scribus/ui/propertiespalette.cpp
M  /trunk/Scribus/scribus/scribusXml.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
M  /trunk/Scribus/scribus/ui/newtemp.cpp
M  /trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp
M  /trunk/Scribus/scribus/ui/reformdoc.cpp
M  /trunk/Scribus/scribus/scribusdoc.cpp
M  /trunk/Scribus/scribus/ui/inspage.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
M  /trunk/Scribus/scribus/fileloader.cpp
M  /trunk/Scribus/scribus/ui/pagepalette.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M  /trunk/Scribus/scribus/ui/tabdisplay.cpp
M  /trunk/Scribus/scribus/ui/margindialog.cpp
M  /trunk/Scribus/scribus/scribus.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
M  /trunk/Scribus/scribus/ui/hysettings.cpp
M  /trunk/Scribus/scribus/hyphenator.cpp
M  /trunk/Scribus/scribus/ui/copypagetomasterpagedialog.h
M  /trunk/Scribus/scribus/canvasmode_edit.cpp
M  /trunk/Scribus/scribus/canvasmode_normal.cpp
M  /trunk/Scribus/scribus/ui/prefs.cpp
M  /trunk/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp
M  /trunk/Scribus/scribus/canvasmode_legacy.cpp
M  /trunk/Scribus/scribus/ui/smtextstyles.cpp
M  /trunk/Scribus/scribus/scribusdoc.h
M  /trunk/Scribus/scribus/scribusview.cpp
M  /trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
M  /trunk/Scribus/scribus/ui/loremipsum.cpp
M  /trunk/Scribus/scribus/pageitem_textframe.cpp
M  /trunk/Scribus/scribus/canvas.cpp
M  /trunk/Scribus/scribus/ui/tabdisplay.h
M  /trunk/Scribus/scribus/canvasmode.cpp
M  /trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp
M  /trunk/Scribus/scribus/ui/tabdocument.cpp
M  /trunk/Scribus/scribus/ui/masterpagepalette.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp

Diffs:
Index: scribus/fileloader.cpp
===================================================================
--- scribus/fileloader.cpp	(revision 14923)
+++ scribus/fileloader.cpp	(revision 14924)
@@ -483,11 +483,11 @@
 	//FIXME: Remove these duplicate settings altogether
 	if (currDoc->docHyphenator!=0)
 	{
-			currDoc->docHyphenator->Automatic=currDoc->Automatic;
-			currDoc->docHyphenator->AutoCheck=currDoc->AutoCheck;
-			currDoc->docHyphenator->Language=currDoc->Language;
-			currDoc->docHyphenator->MinWordLen=currDoc->MinWordLen;
-			currDoc->docHyphenator->HyCount=currDoc->HyCount;
+			currDoc->docHyphenator->Automatic=currDoc->hyphAutomatic();
+			currDoc->docHyphenator->AutoCheck=currDoc->hyphAutoCheck();
+			currDoc->docHyphenator->Language=currDoc->hyphLanguage();
+			currDoc->docHyphenator->MinWordLen=currDoc->hyphMinimumWordLength();
+			currDoc->docHyphenator->HyCount=currDoc->hyphConsecutiveLines();
 	}
 /*	for (uint d = 0; d < ScMW->doc->MasterItems.count(); ++d)
 	{
Index: scribus/hyphenator.cpp
===================================================================
--- scribus/hyphenator.cpp	(revision 14923)
+++ scribus/hyphenator.cpp	(revision 14924)
@@ -46,23 +46,23 @@
 	hdict(0),
 	useAble(false),
 	codec(0),
-	MinWordLen(doc->MinWordLen),
-	HyCount(doc->HyCount),
-	Automatic(doc->Automatic),
-	AutoCheck(doc->AutoCheck)
+	MinWordLen(doc->hyphMinimumWordLength()),
+	HyCount(doc->hyphConsecutiveLines()),
+	Automatic(doc->hyphAutomatic()),
+	AutoCheck(doc->hyphAutoCheck())
 {
-		//FIXME:av pick up language from charstyle
-	QString pfad = ScPaths::instance().dictDir();
+	//FIXME:av pick up language from charstyle
+	QString pfad(ScPaths::instance().dictDir());
 	LanguageManager * lmgr(LanguageManager::instance());
-	if (!lmgr->getHyphFilename(doc->Language, false).isEmpty() )
-		Language = doc->Language;
+	if (!lmgr->getHyphFilename(doc->hyphLanguage(), false).isEmpty() )
+		Language = doc->hyphLanguage();
 	else
 	{
 		Language = PrefsManager::instance()->appPrefs.hyphPrefs.Language;
-		doc->Language = Language;
+		doc->setHyphLanguage(Language);
 	}
 // 	pfad += ScCore->primaryMainWindow()->Sprachen[Language];
-	pfad += lmgr->getHyphFilename( doc->Language, false );
+	pfad += lmgr->getHyphFilename( doc->hyphLanguage(), false );
 	QFile f(pfad);
 	if (f.open(QIODevice::ReadOnly))
 	{
@@ -140,10 +140,10 @@
 	Automatic = Autom;
 	AutoCheck = ACheck;
 	HyCount = Num;
-	doc->MinWordLen = Wordlen;
-	doc->Automatic = Autom;
-	doc->AutoCheck = AutoCheck;
-	doc->HyCount = Num;
+	doc->setHyphMinimumWordLength(Wordlen);
+	doc->setHyphAutomatic(Autom);
+	doc->setHyphAutoCheck(AutoCheck);
+	doc->setHyphAutoCheck(Num);
 }
 
 void Hyphenator::slotHyphenateWord(PageItem* it, const QString& text, int firstC)
Index: scribus/canvasmode.cpp
===================================================================
--- scribus/canvasmode.cpp	(revision 14923)
+++ scribus/canvasmode.cpp	(revision 14924)
@@ -790,7 +790,7 @@
 					if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
 						pg--;
 					else
-						pg -= m_doc->pageSets[m_doc->currentPageLayout].Columns;
+						pg -= m_doc->pageSets()[m_doc->currentPageLayout].Columns;
 					if (pg > -1)
 						m_view->GotoPage(pg);
 				}
@@ -806,7 +806,7 @@
 					if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
 						pg++;
 					else
-						pg += m_doc->pageSets[m_doc->currentPageLayout].Columns;
+						pg += m_doc->pageSets()[m_doc->currentPageLayout].Columns;
 					if (pg < static_cast<int>(m_doc->Pages->count()))
 						m_view->GotoPage(pg);
 				}
Index: scribus/canvasmode_legacy.cpp
===================================================================
--- scribus/canvasmode_legacy.cpp	(revision 14923)
+++ scribus/canvasmode_legacy.cpp	(revision 14924)
@@ -2328,8 +2328,8 @@
 				{
 					double gx, gy, gh, gw;
 					m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
-					FPoint maxSize(gx+gw+m_doc->scratch.Right, gy+gh+m_doc->scratch.Bottom);
-					FPoint minSize(gx-m_doc->scratch.Left, gy-m_doc->scratch.Top);
+					FPoint maxSize(gx+gw+m_doc->scratch()->Right, gy+gh+m_doc->scratch()->Bottom);
+					FPoint minSize(gx-m_doc->scratch()->Left, gy-m_doc->scratch()->Top);
 					m_doc->adjustCanvas(minSize, maxSize);
 				}
 				m_doc->setRedrawBounding(currItem);
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 14923)
+++ scribus/scribusdoc.cpp	(revision 14924)
@@ -164,8 +164,7 @@
 	loading(false),
 	modified(false),
 	ActiveLayer(0),
-	docUnitIndex(appPrefsData.docSetupPrefs.docUnitIndex),
-	docUnitRatio(unitGetRatioFromIndex(docUnitIndex)),
+	//->Prefs docUnitIndex(appPrefsData.docSetupPrefs.docUnitIndex),
 	rotMode(0),
 	automaticTextFrames(0),
 	m_masterPageMode(false),
@@ -178,22 +177,21 @@
 	First(1), Last(0),
 	viewCount(0), viewID(0),
 	SnapGuides(false), GuideLock(false),
-	scratch(appPrefsData.displayPrefs.scratch),
-	GapHorizontal(appPrefsData.displayPrefs.pageGapHorizontal),
-	GapVertical(appPrefsData.displayPrefs.pageGapVertical),
+	//scratch(appPrefsData.displayPrefs.scratch),
+	//->Prefs GapHorizontal(appPrefsData.displayPrefs.pageGapHorizontal),
+	//->Prefs GapVertical(appPrefsData.displayPrefs.pageGapVertical),
 // 	ScratchLeft(prefsData.ScratchLeft),
 // 	ScratchRight(prefsData.ScratchRight),
 // 	ScratchTop(prefsData.ScratchTop),
 // 	ScratchBottom(prefsData.ScratchBottom),
 	minCanvasCoordinate(FPoint(0, 0)),
-	maxCanvasCoordinate(FPoint(scratch.Left + scratch.Right, scratch.Top + scratch.Bottom)),
 	rulerXoffset(0.0), rulerYoffset(0.0),
 	Pages(0), MasterPages(), DocPages(),
 	MasterNames(),
 	Items(0), MasterItems(), DocItems(), FrameItems(),
 	m_Selection(new Selection(this, true)),
 	pageWidth(0), pageHeight(0),
-	pageSets(appPrefsData.pageSets),
+	//->Prefs pageSets(appPrefsData.pageSets),
 	PageSp(1), PageSpa(0),
 	currentPageLayout(0),
 	PageOri(0), m_pageSize(),
@@ -208,7 +206,7 @@
 	UsedFonts(),
 	AllFonts(&appPrefsData.fontPrefs.AvailFonts),
 	AObjects(),
-	papColor(appPrefsData.displayPrefs.paperColor),
+	//->Prefs papColor(appPrefsData.displayPrefs.paperColor),
 	CurrentSel(-1),
 	nodeEdit(),
 	typographicSettings(appPrefsData.typoPrefs),
@@ -229,11 +227,11 @@
 	colorEngine(ScCore->defaultEngine),
 	JavaScripts(),
 	TotalItems(0),
-	MinWordLen(appPrefsData.hyphPrefs.MinWordLen),
-	HyCount(appPrefsData.hyphPrefs.HyCount),
-	Language(appPrefsData.hyphPrefs.Language),
-	Automatic(appPrefsData.hyphPrefs.Automatic),
-	AutoCheck(appPrefsData.hyphPrefs.AutoCheck),
+	//->Prefs MinWordLen(appPrefsData.hyphPrefs.MinWordLen),
+	//->Prefs HyCount(appPrefsData.hyphPrefs.HyCount),
+	//->Prefs Language(appPrefsData.hyphPrefs.Language),
+	//->Prefs Automatic(appPrefsData.hyphPrefs.Automatic),
+	//->Prefs AutoCheck(appPrefsData.hyphPrefs.AutoCheck),
 	PDF_Options(appPrefsData.pdfPrefs),
 	RePos(false),
 	BookMarks(),
@@ -262,6 +260,8 @@
 	m_updateManager(),
 	m_docUpdater(NULL)
 {
+	docUnitRatio=unitGetRatioFromIndex(docPrefsData.docSetupPrefs.docUnitIndex);
+	maxCanvasCoordinate=(FPoint(docPrefsData.displayPrefs.scratch.Left + docPrefsData.displayPrefs.scratch.Right, docPrefsData.displayPrefs.scratch.Top + docPrefsData.displayPrefs.scratch.Bottom)),
 	init();
 	bleeds = appPrefsData.docSetupPrefs.bleeds;
 	PDF_Options.bleeds = bleeds;
@@ -278,8 +278,8 @@
 	loading(false),
 	modified(false),
 	ActiveLayer(0),
-	docUnitIndex(unitindex),
-	docUnitRatio(unitGetRatioFromIndex(docUnitIndex)),
+	//->Prefs docUnitIndex(unitindex),
+	docUnitRatio(unitGetRatioFromIndex(appPrefsData.docSetupPrefs.docUnitIndex)),
 	rotMode(0),
 	automaticTextFrames(pagesSetup.autoTextFrames),
 	m_masterPageMode(false),
@@ -292,15 +292,14 @@
 	First(1), Last(0),
 	viewCount(0), viewID(0),
 	SnapGuides(false), GuideLock(false),
-	scratch(appPrefsData.displayPrefs.scratch),
-	GapHorizontal(appPrefsData.displayPrefs.pageGapHorizontal),
-	GapVertical(appPrefsData.displayPrefs.pageGapVertical),
+	//->Prefs scratch(appPrefsData.displayPrefs.scratch),
+	//->Prefs GapHorizontal(appPrefsData.displayPrefs.pageGapHorizontal),
+	//->Prefs GapVertical(appPrefsData.displayPrefs.pageGapVertical),
 // 	ScratchLeft(prefsData.ScratchLeft),
 // 	ScratchRight(prefsData.ScratchRight),
 // 	ScratchTop(prefsData.ScratchTop),
 // 	ScratchBottom(prefsData.ScratchBottom),
 	minCanvasCoordinate(FPoint(0, 0)),
-	maxCanvasCoordinate(FPoint(scratch.Left + scratch.Right, scratch.Top + scratch.Bottom)),
 	rulerXoffset(0.0), rulerYoffset(0.0),
 	Pages(0), MasterPages(), DocPages(),
 	MasterNames(),
@@ -309,7 +308,7 @@
 	pageWidth(pagesize.width()), pageHeight(pagesize.height()),
 	pageMargins(margins),
 	marginPreset(appPrefsData.docSetupPrefs.marginPreset),
-	pageSets(appPrefsData.pageSets),
+//->Prefs	pageSets(appPrefsData.pageSets),
 	PageSp(pagesSetup.columnCount), PageSpa(pagesSetup.columnDistance),
 	currentPageLayout(pagesSetup.pageArrangement),
 	PageOri(pagesSetup.orientation), m_pageSize(pagesize.name()),
@@ -324,7 +323,7 @@
 	UsedFonts(),
 	AllFonts(&appPrefsData.fontPrefs.AvailFonts),
 	AObjects(),
-	papColor(appPrefsData.displayPrefs.paperColor),
+	//->Prefs papColor(appPrefsData.displayPrefs.paperColor),
 	CurrentSel(-1),
 	nodeEdit(),
 	typographicSettings(appPrefsData.typoPrefs),
@@ -345,11 +344,11 @@
 	colorEngine(ScCore->defaultEngine),
 	JavaScripts(),
 	TotalItems(0),
-	MinWordLen(appPrefsData.hyphPrefs.MinWordLen),
-	HyCount(appPrefsData.hyphPrefs.HyCount),
-	Language(appPrefsData.hyphPrefs.Language),
-	Automatic(appPrefsData.hyphPrefs.Automatic),
-	AutoCheck(appPrefsData.hyphPrefs.AutoCheck),
+	//->Prefs MinWordLen(appPrefsData.hyphPrefs.MinWordLen),
+	//->Prefs HyCount(appPrefsData.hyphPrefs.HyCount),
+	//->Prefs Language(appPrefsData.hyphPrefs.Language),
+	//->Prefs Automatic(appPrefsData.hyphPrefs.Automatic),
+	//->Prefs AutoCheck(appPrefsData.hyphPrefs.AutoCheck),
 	PDF_Options(appPrefsData.pdfPrefs),
 	RePos(false),
 	BookMarks(),
@@ -378,7 +377,10 @@
 	m_updateManager(),
 	m_docUpdater(NULL)
 {
-	pageSets[pagesSetup.pageArrangement].FirstPage = pagesSetup.firstPageLocation;
+	docPrefsData.docSetupPrefs.docUnitIndex=unitindex;
+	maxCanvasCoordinate=(FPoint(docPrefsData.displayPrefs.scratch.Left + docPrefsData.displayPrefs.scratch.Right, docPrefsData.displayPrefs.scratch.Top + docPrefsData.displayPrefs.scratch.Bottom)),
+	setPageSetFirstPage(pagesSetup.pageArrangement, pagesSetup.firstPageLocation);
+	//->Prefs pageSets[pagesSetup.pageArrangement].FirstPage = pagesSetup.firstPageLocation;
 	init();
 	bleeds = appPrefsData.docSetupPrefs.bleeds;
 	PDF_Options.bleeds = bleeds;
@@ -611,8 +613,9 @@
 
 void ScribusDoc::setup(const int unitIndex, const int fp, const int firstLeft, const int orientation, const int firstPageNumber, const QString& defaultPageSize, const QString& documentName)
 {
-	docUnitIndex=unitIndex;
-	pageSets[fp].FirstPage = firstLeft;
+	docPrefsData.docSetupPrefs.docUnitIndex=unitIndex;
+	setPageSetFirstPage(fp, firstLeft);
+	//->Prefs pageSets[fp].FirstPage = firstLeft;
 	PageOri = orientation;
 	m_pageSize = defaultPageSize;
 	FirstPnum = firstPageNumber;
@@ -1721,7 +1724,7 @@
 Page* ScribusDoc::addPage(const int pageIndex, const QString& masterPageName, const bool addAutoFrame)
 {
 	assert(masterPageMode()==false);
-	Page* addedPage = new Page(scratch.Left, DocPages.count()*(pageHeight+scratch.Bottom+scratch.Top)+scratch.Top, pageWidth, pageHeight);
+	Page* addedPage = new Page(docPrefsData.displayPrefs.scratch.Left, DocPages.count()*(pageHeight+docPrefsData.displayPrefs.scratch.Bottom+docPrefsData.displayPrefs.scratch.Top)+docPrefsData.displayPrefs.scratch.Top, pageWidth, pageHeight);
 	assert(addedPage!=NULL);
 	addedPage->setDocument(this);
 	addedPage->Margins.Top = pageMargins.Top;
@@ -1753,7 +1756,7 @@
 {
 	//CB We dont create master pages (yet) with a pageCount based location
 	//Page* addedPage = new Page(ScratchLeft, MasterPages.count()*(pageHeight+ScratchBottom+ScratchTop)+ScratchTop, pageWidth, pageHeight);
-	Page* addedPage = new Page(scratch.Left, scratch.Top, pageWidth, pageHeight);
+	Page* addedPage = new Page(docPrefsData.displayPrefs.scratch.Left, docPrefsData.displayPrefs.scratch.Top, pageWidth, pageHeight);
 	assert(addedPage!=NULL);
 	addedPage->setDocument(this);
 	addedPage->Margins.Top = pageMargins.Top;
@@ -3252,14 +3255,14 @@
 
 void ScribusDoc::setUnitIndex(const int newIndex)
 {
-	docUnitIndex=newIndex;
-	docUnitRatio = unitGetRatioFromIndex( docUnitIndex );
+	docPrefsData.docSetupPrefs.docUnitIndex=newIndex;
+	docUnitRatio = unitGetRatioFromIndex( newIndex );
 }
 
 
 int ScribusDoc::unitIndex() const
 {
-	return docUnitIndex;
+	return docPrefsData.docSetupPrefs.docUnitIndex;
 }
 
 
@@ -3324,7 +3327,7 @@
 
 		Ap->initialMargins.Top = Mp->Margins.Top;
 		Ap->initialMargins.Bottom = Mp->Margins.Bottom;
-		if (pageSets[currentPageLayout].Columns == 1)
+		if (pageSets()[currentPageLayout].Columns == 1)
 		{
 			Ap->initialMargins.Left = Mp->Margins.Left;
 			Ap->initialMargins.Right = Mp->Margins.Right;
@@ -4827,12 +4830,12 @@
 {
 	QMap<uint, oldPageVar> pageTable;
 	struct oldPageVar oldPg;
-	int counter = pageSets[currentPageLayout].FirstPage;
+	int counter = pageSets()[currentPageLayout].FirstPage;
 	int rowcounter = 0;
 	double maxYPos=0.0, maxXPos=0.0;
-	double currentXPos=scratch.Left, currentYPos=scratch.Top, lastYPos=Pages->at(0)->initialHeight();
+	double currentXPos=docPrefsData.displayPrefs.scratch.Left, currentYPos=docPrefsData.displayPrefs.scratch.Top, lastYPos=Pages->at(0)->initialHeight();
 //	currentXPos += (pageWidth+pageSets[currentPageLayout].GapHorizontal) * counter;
-	currentXPos += (pageWidth+GapHorizontal) * counter;
+	currentXPos += (pageWidth+docPrefsData.displayPrefs.pageGapHorizontal) * counter;
 
 	lastYPos = Pages->at(0)->initialHeight();
 	Page* Seite;
@@ -4847,14 +4850,14 @@
 		Seite->setPageNr(a);
 		if (masterPageMode())
 		{
-			Seite->setXOffset(scratch.Left);
-			Seite->setYOffset(scratch.Top);
+			Seite->setXOffset(docPrefsData.displayPrefs.scratch.Left);
+			Seite->setYOffset(docPrefsData.displayPrefs.scratch.Top);
 			if (Seite->LeftPg == 0)
 			{
 				Seite->Margins.Right = Seite->initialMargins.Right;
 				Seite->Margins.Left = Seite->initialMargins.Left;
 			}
-			else if ((Seite->LeftPg > 1) && (Seite->LeftPg < pageSets[currentPageLayout].Columns))
+			else if ((Seite->LeftPg > 1) && (Seite->LeftPg < pageSets()[currentPageLayout].Columns))
 			{
 				Seite->Margins.Left = Seite->initialMargins.Left;
 				Seite->Margins.Right = Seite->initialMargins.Left;
@@ -4871,10 +4874,10 @@
 			Seite->setHeight(Seite->initialHeight());
 			Seite->setXOffset(currentXPos);
 			Seite->setYOffset(currentYPos);
-			if (counter < pageSets[currentPageLayout].Columns-1)
+			if (counter < pageSets()[currentPageLayout].Columns-1)
 			{
 //				currentXPos += Seite->width() + pageSets[currentPageLayout].GapHorizontal;
-				currentXPos += Seite->width() + GapHorizontal;
+				currentXPos += Seite->width() + docPrefsData.displayPrefs.pageGapHorizontal;
 				lastYPos = qMax(lastYPos, Seite->height());
 				if (counter == 0)
 				{
@@ -4889,12 +4892,12 @@
 			}
 			else
 			{
-				currentXPos = scratch.Left;
-				if (pageSets[currentPageLayout].Columns > 1)
-					currentYPos += qMax(lastYPos, Seite->height())+GapVertical;
+				currentXPos = docPrefsData.displayPrefs.scratch.Left;
+				if (pageSets()[currentPageLayout].Columns > 1)
+					currentYPos += qMax(lastYPos, Seite->height())+docPrefsData.displayPrefs.pageGapVertical;
 //					currentYPos += qMax(lastYPos, Seite->height())+pageSets[currentPageLayout].GapVertical;
 				else
-					currentYPos += Seite->height()+GapVertical;
+					currentYPos += Seite->height()+docPrefsData.displayPrefs.pageGapVertical;
 //					currentYPos += Seite->height()+pageSets[currentPageLayout].GapVertical;
 //				lastYPos = qMax(lastYPos, Seite->height());
 				lastYPos = 0;
@@ -4902,11 +4905,11 @@
 				Seite->Margins.Left = Seite->initialMargins.Left;
 			}
 			counter++;
-			if (counter > pageSets[currentPageLayout].Columns-1)
+			if (counter > pageSets()[currentPageLayout].Columns-1)
 			{
 				counter = 0;
 				rowcounter++;
-				if (rowcounter > pageSets[currentPageLayout].Rows-1)
+				if (rowcounter > pageSets()[currentPageLayout].Rows-1)
 				{
 //					currentYPos += GapVertical;
 //					currentYPos += pageSets[currentPageLayout].GapBelow;
@@ -4916,8 +4919,8 @@
 		}
 		Seite->Margins.Top = Seite->initialMargins.Top;
 		Seite->Margins.Bottom = Seite->initialMargins.Bottom;
-		maxXPos = qMax(maxXPos, Seite->xOffset()+Seite->width()+scratch.Right);
-		maxYPos = qMax(maxYPos, Seite->yOffset()+Seite->height()+scratch.Bottom);
+		maxXPos = qMax(maxXPos, Seite->xOffset()+Seite->width()+docPrefsData.displayPrefs.scratch.Right);
+		maxYPos = qMax(maxYPos, Seite->yOffset()+Seite->height()+docPrefsData.displayPrefs.scratch.Bottom);
 	}
 	if (!isLoading())
 	{
@@ -4960,8 +4963,8 @@
 	{
 		FPoint minPoint, maxPoint;
 		canvasMinMax(minPoint, maxPoint);
-		FPoint maxSize(qMax(maxXPos, maxPoint.x()+scratch.Right), qMax(maxYPos, maxPoint.y()+scratch.Bottom));
-		adjustCanvas(FPoint(qMin(0.0, minPoint.x()-scratch.Left),qMin(0.0, minPoint.y()-scratch.Top)), maxSize, true);
+		FPoint maxSize(qMax(maxXPos, maxPoint.x()+docPrefsData.displayPrefs.scratch.Right), qMax(maxYPos, maxPoint.y()+docPrefsData.displayPrefs.scratch.Bottom));
+		adjustCanvas(FPoint(qMin(0.0, minPoint.x()-docPrefsData.displayPrefs.scratch.Left),qMin(0.0, minPoint.y()-docPrefsData.displayPrefs.scratch.Top)), maxSize, true);
 		changed();
 	}
 	else
@@ -5002,7 +5005,7 @@
 {
 	bleedData.Bottom = baseValues.Bottom;
 	bleedData.Top    = baseValues.Top;
-	if (pageSets[currentPageLayout].Columns == 1)
+	if (pageSets()[currentPageLayout].Columns == 1)
 	{
 		bleedData.Right = baseValues.Right;
 		bleedData.Left  = baseValues.Left;
@@ -5531,7 +5534,7 @@
 			--destLocation;
 		else if (whereToInsert==2)
 			destLocation=DocPages.count();
-		Page* destination = new Page(scratch.Left, DocPages.count()*(pageHeight+scratch.Bottom+scratch.Top)+scratch.Top, pageWidth, pageHeight);
+		Page* destination = new Page(docPrefsData.displayPrefs.scratch.Left, DocPages.count()*(pageHeight+docPrefsData.displayPrefs.scratch.Bottom+docPrefsData.displayPrefs.scratch.Top)+docPrefsData.displayPrefs.scratch.Top, pageWidth, pageHeight);
 		destination->setDocument(this);
 		destination->setPageNr(destLocation);
 		lastDest = destination;
@@ -5546,7 +5549,7 @@
 		//TODO make a fucntion to do this margin stuff and use elsewhere too
 		destination->initialMargins.Top = from->initialMargins.Top;
 		destination->initialMargins.Bottom = from->initialMargins.Bottom;
-		if (pageSets[currentPageLayout].Columns == 1)
+		if (pageSets()[currentPageLayout].Columns == 1)
 		{
 			destination->initialMargins.Left = from->initialMargins.Left;
 			destination->initialMargins.Right = from->initialMargins.Right;
@@ -5609,7 +5612,7 @@
 
 void ScribusDoc::setLocationBasedPageLRMargins(const uint pageIndex)
 {
-	int setcol=pageSets[currentPageLayout].Columns;
+	int setcol=pageSets()[currentPageLayout].Columns;
 	if (setcol==1)
 	{
 		Page* pageToAdjust=DocPages.at(pageIndex);
@@ -5699,7 +5702,7 @@
 	int myCol=columnOfPage(pageIndex);
 	if (myCol==0) //Left hand page
 		return LeftPage;
-	else if (myCol>= pageSets[currentPageLayout].Columns-1) // Right hand page
+	else if (myCol>= pageSets()[currentPageLayout].Columns-1) // Right hand page
 		return RightPage;
 	else //Middle pages
 		return MiddlePage;
@@ -5707,8 +5710,8 @@
 
 int ScribusDoc::columnOfPage(int pageIndex) const
 {
-	int setcol=pageSets[currentPageLayout].Columns;
-	return ((pageIndex % setcol) + pageSets[currentPageLayout].FirstPage) % setcol;
+	int setcol=pageSets()[currentPageLayout].Columns;
+	return ((pageIndex % setcol) + pageSets()[currentPageLayout].FirstPage) % setcol;
 }
 
 
@@ -7191,8 +7194,8 @@
 void ScribusDoc::setRedrawBounding(PageItem *currItem)
 {
 	currItem->setRedrawBounding();
-	FPoint maxSize(currItem->BoundingX+currItem->BoundingW+scratch.Right, currItem->BoundingY+currItem->BoundingH+scratch.Bottom);
-	FPoint minSize(currItem->BoundingX-scratch.Left, currItem->BoundingY-scratch.Top);
+	FPoint maxSize(currItem->BoundingX+currItem->BoundingW+docPrefsData.displayPrefs.scratch.Right, currItem->BoundingY+currItem->BoundingH+docPrefsData.displayPrefs.scratch.Bottom);
+	FPoint minSize(currItem->BoundingX-docPrefsData.displayPrefs.scratch.Left, currItem->BoundingY-docPrefsData.displayPrefs.scratch.Top);
 	adjustCanvas(minSize, maxSize);
 }
 
@@ -10191,7 +10194,7 @@
 
 void ScribusDoc::createDefaultMasterPages()
 {
-	int setcol = pageSets[currentPageLayout].Columns;
+	int setcol = pageSets()[currentPageLayout].Columns;
 	if (setcol == 1)
 	{
 		addMasterPage(0, CommonStrings::trMasterPageNormal);
@@ -10227,7 +10230,7 @@
 
 void ScribusDoc::createNewDocPages(int pageCount)
 {
-	int setcol = pageSets[currentPageLayout].Columns;
+	int setcol = pageSets()[currentPageLayout].Columns;
 	int createCount=qMax(pageCount,1);
 	if (setcol == 1)
 	{
@@ -12066,6 +12069,10 @@
 	emit rotationMode(rotMode);
 }
 
+void ScribusDoc::setPageSetFirstPage(int layout, int fp)
+{
+	docPrefsData.pageSets[layout].FirstPage=fp;
+}
 
 
 
Index: scribus/scribusXml.cpp
===================================================================
--- scribus/scribusXml.cpp	(revision 14923)
+++ scribus/scribusXml.cpp	(revision 14924)
@@ -1336,7 +1336,7 @@
 				OB.IFont = DoFonts[tmf];
 			// #7725
 			OB.LayerID   = toLayer;
-			OB.Language  = attrAsString(attrs, "LANGUAGE", doc->Language);
+			OB.Language  = attrAsString(attrs, "LANGUAGE", doc->hyphLanguage());
 			tmp = "";
 			int numGroup = attrAsInt(attrs, "NUMGROUP", 0);
 			if ((!attrs.value("GROUPS").isEmpty()) && (numGroup > 0))
@@ -1804,7 +1804,7 @@
 			else
 				OB.IFont = DoFonts[tmf];
 			OB.LayerID  = attrAsInt(attrs1, "LAYER");
-			OB.Language = attrAsString(attrs1, "LANGUAGE", doc->Language);
+			OB.Language = attrAsString(attrs1, "LANGUAGE", doc->hyphLanguage());
 			tmp = "";
 			int numGroup = attrAsInt(attrs1, "NUMGROUP", 0);
 			if ((!attrs1.value("GROUPS").isEmpty()) && (numGroup > 0))
Index: scribus/canvasmode_edit.cpp
===================================================================
--- scribus/canvasmode_edit.cpp	(revision 14923)
+++ scribus/canvasmode_edit.cpp	(revision 14924)
@@ -798,8 +798,8 @@
 			{
 				double gx, gy, gh, gw;
 				m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
-				FPoint maxSize(gx+gw+m_doc->scratch.Right, gy+gh+m_doc->scratch.Bottom);
-				FPoint minSize(gx-m_doc->scratch.Left, gy-m_doc->scratch.Top);
+				FPoint maxSize(gx+gw+m_doc->scratch()->Right, gy+gh+m_doc->scratch()->Bottom);
+				FPoint minSize(gx-m_doc->scratch()->Left, gy-m_doc->scratch()->Top);
 				m_doc->adjustCanvas(minSize, maxSize);
 			}
 			m_doc->setRedrawBounding(currItem);
Index: scribus/canvas.cpp
===================================================================
--- scribus/canvas.cpp	(revision 14923)
+++ scribus/canvas.cpp	(revision 14924)
@@ -954,8 +954,8 @@
 		painter->endLayer();
 //		Tcontents = tim.elapsed();
 		
-		double x = m_doc->scratch.Left * m_viewMode.scale;
-		double y = m_doc->scratch.Top * m_viewMode.scale;
+		double x = m_doc->scratch()->Left * m_viewMode.scale;
+		double y = m_doc->scratch()->Top * m_viewMode.scale;
 		double w = m_doc->currentPage()->width() * m_viewMode.scale;
 		double h = m_doc->currentPage()->height() * m_viewMode.scale;
 		QRectF drawRect = QRectF(x, y, w+5, h+5);
@@ -1809,8 +1809,8 @@
  */
 void Canvas::drawBackgroundMasterpage(ScPainter* painter, int clipx, int clipy, int clipw, int cliph)
 {
-	double x = m_doc->scratch.Left * m_viewMode.scale;
-	double y = m_doc->scratch.Top * m_viewMode.scale;
+	double x = m_doc->scratch()->Left * m_viewMode.scale;
+	double y = m_doc->scratch()->Top * m_viewMode.scale;
 	double w = m_doc->currentPage()->width() * m_viewMode.scale;
 	double h = m_doc->currentPage()->height() * m_viewMode.scale;
 	QRectF drawRect = QRectF(x, y, w+5, h+5);
@@ -1828,17 +1828,17 @@
 		{
 //			painter->drawRect(m_doc->scratch.Left - bleedLeft+5 / m_viewMode.scale, m_doc->scratch.Top - bleedTop+5 / m_viewMode.scale, m_doc->currentPage()->width() + bleedLeft + bleedRight, m_doc->currentPage()->height() + bleedBottom + bleedTop);
 			if (PrefsManager::instance()->appPrefs.displayPrefs.showPageShadow)
-				painter->drawRect(m_doc->scratch.Left - pageBleeds.Left+5, m_doc->scratch.Top - pageBleeds.Top+5, m_doc->currentPage()->width() + pageBleeds.Left + pageBleeds.Right, m_doc->currentPage()->height() + pageBleeds.Bottom + pageBleeds.Top);
-			painter->setBrush(m_doc->papColor);
-			painter->drawRect(m_doc->scratch.Left - pageBleeds.Left, m_doc->scratch.Top - pageBleeds.Top, m_doc->currentPage()->width() + pageBleeds.Left + pageBleeds.Right, m_doc->currentPage()->height() + pageBleeds.Bottom + pageBleeds.Top);
+				painter->drawRect(m_doc->scratch()->Left - pageBleeds.Left+5, m_doc->scratch()->Top - pageBleeds.Top+5, m_doc->currentPage()->width() + pageBleeds.Left + pageBleeds.Right, m_doc->currentPage()->height() + pageBleeds.Bottom + pageBleeds.Top);
+			painter->setBrush(m_doc->paperColor());
+			painter->drawRect(m_doc->scratch()->Left - pageBleeds.Left, m_doc->scratch()->Top - pageBleeds.Top, m_doc->currentPage()->width() + pageBleeds.Left + pageBleeds.Right, m_doc->currentPage()->height() + pageBleeds.Bottom + pageBleeds.Top);
 		}
 		else
 		{
 //			painter->drawRect(m_doc->scratch.Left+5 / m_viewMode.scale, m_doc->scratch.Top+5 / m_viewMode.scale, m_doc->currentPage()->width(), m_doc->currentPage()->height());
 			if (PrefsManager::instance()->appPrefs.displayPrefs.showPageShadow)
-				painter->drawRect(m_doc->scratch.Left+5, m_doc->scratch.Top+5, m_doc->currentPage()->width(), m_doc->currentPage()->height());
-			painter->setBrush(m_doc->papColor);
-			painter->drawRect(m_doc->scratch.Left, m_doc->scratch.Top, m_doc->currentPage()->width(), m_doc->currentPage()->height());
+				painter->drawRect(m_doc->scratch()->Left+5, m_doc->scratch()->Top+5, m_doc->currentPage()->width(), m_doc->currentPage()->height());
+			painter->setBrush(m_doc->paperColor());
+			painter->drawRect(m_doc->scratch()->Left, m_doc->scratch()->Top, m_doc->currentPage()->width(), m_doc->currentPage()->height());
 		}
 		painter->setAntialiasing(true);
 		if (m_doc->guidesSettings.guidePlacement)
@@ -1934,7 +1934,7 @@
 			painter->setAntialiasing(false);
 //			painter->beginLayer(1.0, 0);
 			painter->setLineWidth(0.0);
-			painter->setBrush(m_doc->papColor);
+			painter->setBrush(m_doc->paperColor());
 			if (!m_viewMode.viewAsPreview)
 			{
 				double blx2 = actPg->xOffset() - pageBleeds.Left;
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 14923)
+++ scribus/scribusdoc.h	(revision 14924)
@@ -143,6 +143,29 @@
 	MassObservable<Page*>     * pagesChanged() { return &m_pagesChanged; }
 	MassObservable<QRectF>    * regionsChanged() { return &m_regionsChanged; }
 	void invalidateRegion(QRectF region);
+
+
+	MarginStruct* scratch() { return &docPrefsData.displayPrefs.scratch; }
+	double pageGapHorizontal() const { return docPrefsData.displayPrefs.pageGapHorizontal; }
+	double pageGapVertical() const { return docPrefsData.displayPrefs.pageGapVertical; }
+	void setPageGapHorizontal(double h) { docPrefsData.displayPrefs.pageGapHorizontal=h; }
+	void setPageGapVertical(double v) { docPrefsData.displayPrefs.pageGapVertical=v; }
+	const QList<PageSet>& pageSets() const { return docPrefsData.pageSets; }
+	void setPageSetFirstPage(int layout, int fp);
+	void clearPageSets() { docPrefsData.pageSets.clear(); }
+	void appendToPageSets(const PageSet& ps) { docPrefsData.pageSets.append(ps); }
+	void setPaperColor(const QColor &c) { docPrefsData.displayPrefs.paperColor=c; }
+	const QColor& paperColor() const { return docPrefsData.displayPrefs.paperColor; }
+	int hyphMinimumWordLength() const { return docPrefsData.hyphPrefs.MinWordLen; }
+	int hyphConsecutiveLines() const { return docPrefsData.hyphPrefs.HyCount; }
+	const QString& hyphLanguage() const { return docPrefsData.hyphPrefs.Language; }
+	bool hyphAutomatic() const { return docPrefsData.hyphPrefs.Automatic; }
+	bool hyphAutoCheck() const { return docPrefsData.hyphPrefs.AutoCheck; }
+	void setHyphMinimumWordLength(int i) { docPrefsData.hyphPrefs.MinWordLen=i; }
+	void setHyphConsecutiveLines(int i) { docPrefsData.hyphPrefs.HyCount=i; }
+	void setHyphLanguage(const QString& s) { docPrefsData.hyphPrefs.Language=s; }
+	void setHyphAutomatic(bool b) { docPrefsData.hyphPrefs.Automatic=b; }
+	void setHyphAutoCheck(bool b) { docPrefsData.hyphPrefs.AutoCheck=b; }
 	
 	// Add, delete and move pages
 	
@@ -928,7 +951,7 @@
 	bool loading;
 	bool modified;
 	int ActiveLayer;
-	int docUnitIndex;
+	//->Prefs int docUnitIndex;
 	double docUnitRatio;
 	int rotMode;
 	bool automaticTextFrames; // Flag for automatic Textframes
@@ -949,9 +972,9 @@
 	bool SnapGuides;
 	bool GuideLock;
 	/** \brief Scratch space around Pages */
-	MarginStruct scratch;
-	double GapHorizontal;
-	double GapVertical;
+	//->Prefs MarginStruct scratch;
+	//->Prefs double GapHorizontal;
+	//->Prefs double GapVertical;
 // 	double ScratchLeft;
 // 	double ScratchRight;
 // 	double ScratchTop;
@@ -984,7 +1007,7 @@
 	/** \brief Margins */
 	MarginStruct pageMargins;
 	int marginPreset;
-	QList<PageSet> pageSets;
+	//->Prefs QList<PageSet> pageSets;
 	MarginStruct bleeds;
 // 	double BleedTop;
 // 	double BleedLeft;
@@ -1015,7 +1038,7 @@
 	QMap<QString,int> UsedFonts;
 	SCFonts * const AllFonts;
 	QList<AlignObjs> AObjects;
-	QColor papColor;
+	//->Prefs QColor papColor;
 	int CurrentSel;
 	ParagraphStyle currentStyle;
 
@@ -1072,11 +1095,11 @@
 	bool HasCMS;
 	QMap<QString,QString> JavaScripts;
 	int TotalItems;
-	int MinWordLen;
-	int HyCount;
-	QString Language;
-	bool Automatic;
-	bool AutoCheck;
+	//->Prefs int MinWordLen;
+	//->Prefs int HyCount;
+	//->Prefs QString Language;
+	//->Prefs bool Automatic;
+	//->Prefsbool AutoCheck;
 	PDFOptions PDF_Options;
 	PrintOptions Print_Options;
 	bool RePos;
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(revision 14923)
+++ scribus/scribusview.cpp	(revision 14924)
@@ -2921,8 +2921,8 @@
 	ScLayer layer;
 	layer.isViewable = false;
 	int Nr = Doc->MasterNames[name];
-	int clipx = static_cast<int>(Doc->scratch.Left);
-	int clipy = static_cast<int>(Doc->scratch.Top);
+	int clipx = static_cast<int>(Doc->scratch()->Left);
+	int clipy = static_cast<int>(Doc->scratch()->Top);
 	int clipw = qRound(Doc->MasterPages.at(Nr)->width());
 	int cliph = qRound(Doc->MasterPages.at(Nr)->height());
 	if ((clipw > 0) && (cliph > 0))
@@ -2944,13 +2944,13 @@
 		m_canvas->m_viewMode.forceRedraw = true;
 		pm = QImage(clipw, cliph, QImage::Format_ARGB32_Premultiplied);
 		ScPainter *painter = new ScPainter(&pm, pm.width(), pm.height(), 1.0, 0);
-		painter->clear(Doc->papColor);
+		painter->clear(Doc->paperColor());
 		painter->translate(-clipx, -clipy);
 		painter->setLineWidth(1);
 		if (drawFrame)
 		{
 			painter->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-			painter->setBrush(Doc->papColor);
+			painter->setBrush(Doc->paperColor());
 			painter->drawRect(clipx, clipy, clipw, cliph);
 		}
 		painter->beginLayer(1.0, 0);
@@ -3014,13 +3014,13 @@
 			Doc->setLoading(true);
 			Doc->setCurrentPage(Doc->DocPages.at(Nr));
 			ScPainter *painter = new ScPainter(&im, im.width(), im.height(), 1.0, 0);
-			painter->clear(Doc->papColor);
+			painter->clear(Doc->paperColor());
 			painter->translate(-clipx, -clipy);
 			painter->setFillMode(ScPainter::Solid);
 			if (drawFrame)
 			{
 				painter->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-				painter->setBrush(Doc->papColor);
+				painter->setBrush(Doc->paperColor());
 				painter->drawRect(clipx, clipy, clipw, cliph);
 			}
 			painter->beginLayer(1.0, 0);
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp	(revision 14923)
+++ scribus/pageitem_textframe.cpp	(revision 14924)
@@ -1562,7 +1562,7 @@
 			
 			//FIXME: asce / desc set correctly?
 			if (legacy && 
-				(((hl->ch == '-' || (hl->effects() & ScStyle_HyphenationPossible)) && (current.hyphenCount < m_Doc->HyCount || m_Doc->HyCount == 0))  
+				(((hl->ch == '-' || (hl->effects() & ScStyle_HyphenationPossible)) && (current.hyphenCount < m_Doc->hyphConsecutiveLines() || m_Doc->hyphConsecutiveLines() == 0))
 				|| hl->ch == SpecialChars::SHYPHEN))
 			{
 				if (hl->effects() & ScStyle_HyphenationPossible || hl->ch == SpecialChars::SHYPHEN)
@@ -1626,7 +1626,7 @@
 				
 				if (legacy || (breakPos - rightHang < current.colRight - style.rightMargin()))
 				{
-					if ((current.hyphenCount < m_Doc->HyCount) || (m_Doc->HyCount == 0) || hl->ch == SpecialChars::SHYPHEN)
+					if ((current.hyphenCount < m_Doc->hyphConsecutiveLines()) || (m_Doc->hyphConsecutiveLines() == 0) || hl->ch == SpecialChars::SHYPHEN)
 					{
 						current.rememberBreak(a, breakPos);
 					}
Index: scribus/ui/tabdocument.cpp
===================================================================
--- scribus/ui/tabdocument.cpp	(revision 14923)
+++ scribus/ui/tabdocument.cpp	(revision 14924)
@@ -259,7 +259,7 @@
 //	setOrien(prefsData->PageOri);
 
 	docLayout->selectItem(prefsData->currentPageLayout);
-	docLayout->firstPage->setCurrentIndex(prefsData->pageSets[prefsData->currentPageLayout].FirstPage);
+	docLayout->firstPage->setCurrentIndex(prefsData->pageSets()[prefsData->currentPageLayout].FirstPage);
 	pageOrientationComboBox->setCurrentIndex(prefsData->PageOri);
 	unitCombo->setCurrentIndex(prefsData->unitIndex());
 	pageWidth->setValue(prefsData->pageWidth * unitRatio);
Index: scribus/ui/loremipsum.cpp
===================================================================
--- scribus/ui/loremipsum.cpp	(revision 14923)
+++ scribus/ui/loremipsum.cpp	(revision 14924)
@@ -229,7 +229,7 @@
 	resize( QSize(320, 340).expandedTo(minimumSizeHint()) );
 	QList<QTreeWidgetItem *> defItem;
 	defItem.clear();
-	defItem = loremList->findItems(langmgr->getTransLangFromLang(m_Doc->Language), Qt::MatchExactly);
+	defItem = loremList->findItems(langmgr->getTransLangFromLang(m_Doc->hyphLanguage()), Qt::MatchExactly);
 	if (defItem.count() == 0)
 		defItem = loremList->findItems(standardloremtext, Qt::MatchExactly);
 	if (defItem.count() != 0)
Index: scribus/ui/tabdisplay.h
===================================================================
--- scribus/ui/tabdisplay.h	(revision 14923)
+++ scribus/ui/tabdisplay.h	(revision 14924)
@@ -25,7 +25,7 @@
 	public:
 		TabDisplay(QWidget* parent = 0, const char* name = 0);
 		~TabDisplay(){};
-		void restoreDefaults(struct ApplicationPrefs *prefsData, struct GuidesPrefs &guidesSettings, QList<PageSet> &pageSets, int pageLayout, MarginStruct &scratch);
+		void restoreDefaults(struct ApplicationPrefs *prefsData, struct GuidesPrefs &guidesSettings, int pageLayout, MarginStruct &scratch);
 		void unitChange(int docUnitIx);
 		//! \brief Hide non-needed widgets for ReformDoc widget
 		void setDocSetupMode();
Index: scribus/ui/prefs.cpp
===================================================================
--- scribus/ui/prefs.cpp	(revision 14923)
+++ scribus/ui/prefs.cpp	(revision 14924)
@@ -201,7 +201,7 @@
 	tabGeneral->restoreDefaults(prefsData);
 	tabDocument->restoreDefaults(prefsData);
 	tabPrinter->restoreDefaults(prefsData);
-	tabView->restoreDefaults(prefsData, prefsData->guidesPrefs, prefsData->pageSets, prefsData->docSetupPrefs.pagePositioning, prefsData->displayPrefs.scratch);
+	tabView->restoreDefaults(prefsData, prefsData->guidesPrefs, prefsData->docSetupPrefs.pagePositioning, prefsData->displayPrefs.scratch);
 	tabView->gapHorizontal->setValue(prefsData->displayPrefs.pageGapHorizontal);
 	tabView->gapVertical->setValue(prefsData->displayPrefs.pageGapVertical);
 	tabScrapbook->restoreDefaults(prefsData);
Index: scribus/ui/margindialog.cpp
===================================================================
--- scribus/ui/margindialog.cpp	(revision 14923)
+++ scribus/ui/margindialog.cpp	(revision 14924)
@@ -90,7 +90,8 @@
 		dsGroupBox7Layout->addWidget( TextLabel3, 4, 0, 1, 2 );
 		Links = new QComboBox( dsGroupBox7 );
 		QStringList::Iterator pNames;
-		for(pNames = doc->pageSets[doc->currentPageLayout].pageNames.begin(); pNames != doc->pageSets[doc->currentPageLayout].pageNames.end(); ++pNames )
+		QList<PageSet> pageSet(doc->pageSets());
+		for(pNames = pageSet[doc->currentPageLayout].pageNames.begin(); pNames != pageSet[doc->currentPageLayout].pageNames.end(); ++pNames )
 		{
 			//Links->insertItem((*pNames));
 			Links->addItem(CommonStrings::translatePageSetLocString((*pNames)));
Index: scribus/ui/pagepalette.cpp
===================================================================
--- scribus/ui/pagepalette.cpp	(revision 14923)
+++ scribus/ui/pagepalette.cpp	(revision 14924)
@@ -698,7 +698,7 @@
 
 void PagePalette::handlePageLayout(int layout)
 {
-	pageLayout->selectFirstP(currView->Doc->pageSets[layout].FirstPage);
+	pageLayout->selectFirstP(currView->Doc->pageSets()[layout].FirstPage);
 	currView->Doc->resetPage(currView->Doc->pageMargins, layout);
 	currView->reformPages();
 	currView->DrawNew();
@@ -710,7 +710,8 @@
 
 void PagePalette::handleFirstPage(int fp)
 {
-	currView->Doc->pageSets[currView->Doc->currentPageLayout].FirstPage = fp;
+//	currView->Doc->pageSets()[currView->Doc->currentPageLayout].FirstPage = fp;
+	currView->Doc->setPageSetFirstPage(currView->Doc->currentPageLayout, fp);
 	currView->reformPages();
 	currView->DrawNew();
 	currView->GotoPage(currView->Doc->currentPageNumber());
@@ -756,17 +757,17 @@
 		connect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
 		return;
 	}
-	pageLayout->updateLayoutSelector(currView->Doc->pageSets);
+	pageLayout->updateLayoutSelector(currView->Doc->pageSets());
 	pageLayout->selectItem(currView->Doc->currentPageLayout);
-	pageLayout->firstPage->setCurrentIndex(currView->Doc->pageSets[currView->Doc->currentPageLayout].FirstPage);
+	pageLayout->firstPage->setCurrentIndex(currView->Doc->pageSets()[currView->Doc->currentPageLayout].FirstPage);
 	pageView->MaxC = currView->Doc->DocPages.count()-1;
-	int counter, rowcounter, colmult, rowmult, coladd,rowadd;
-	counter = currView->Doc->pageSets[currView->Doc->currentPageLayout].FirstPage;
-	int cols = currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns;
-	int rows = (currView->Doc->DocPages.count()+counter) / currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns;
-	if (((currView->Doc->DocPages.count()+counter) % currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns) != 0)
+	int counter = currView->Doc->pageSets()[currView->Doc->currentPageLayout].FirstPage;
+	int cols = currView->Doc->pageSets()[currView->Doc->currentPageLayout].Columns;
+	int rows = (currView->Doc->DocPages.count()+counter) / currView->Doc->pageSets()[currView->Doc->currentPageLayout].Columns;
+	if (((currView->Doc->DocPages.count()+counter) % currView->Doc->pageSets()[currView->Doc->currentPageLayout].Columns) != 0)
 		rows++;
-	rowcounter = 0;
+	int rowcounter = 0;
+	int colmult, rowmult, coladd, rowadd;
 	if (cols == 1)
 	{
 		pageView->setColumnCount(cols);
@@ -799,7 +800,7 @@
 	pageView->rowadd = rowadd;
 	pageView->rowmult = rowmult;
 	pageView->firstP = counter;
-	pageView->cols = currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns;
+	pageView->cols = currView->Doc->pageSets()[currView->Doc->currentPageLayout].Columns;
 	pageList.clear();
 	for (int a = 0; a < currView->Doc->DocPages.count(); ++a)
 	{
@@ -816,7 +817,7 @@
 		else
 			pageView->setRowHeight(rowcounter*rowmult+rowadd, pix.height()+5);
 		counter++;
-		if (counter > currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns-1)
+		if (counter > currView->Doc->pageSets()[currView->Doc->currentPageLayout].Columns-1)
 		{
 			counter = 0;
 			rowcounter++;
Index: scribus/ui/tabdisplay.cpp
===================================================================
--- scribus/ui/tabdisplay.cpp	(revision 14923)
+++ scribus/ui/tabdisplay.cpp	(revision 14924)
@@ -60,7 +60,8 @@
 	connect(rulerUnitCombo, SIGNAL(activated(int)), this, SLOT(drawRuler()));
 }
 
-void TabDisplay::restoreDefaults(struct ApplicationPrefs *prefsData, struct GuidesPrefs &guidesSettings, QList<PageSet> &pageSets, int pageLayout, MarginStruct &scratch)
+void TabDisplay::restoreDefaults(struct ApplicationPrefs *prefsData, struct GuidesPrefs &guidesSettings, int pageLayout, MarginStruct &scratch)
+//void TabDisplay::restoreDefaults(struct ApplicationPrefs *prefsData, struct GuidesPrefs &guidesSettings, QList<PageSet> &pageSets, int pageLayout, MarginStruct &scratch)
 {
 	docUnitIndex = prefsData->docSetupPrefs.docUnitIndex;
 	double unitRatio = unitGetRatioFromIndex(docUnitIndex);
Index: scribus/ui/reformdoc.cpp
===================================================================
--- scribus/ui/reformdoc.cpp	(revision 14923)
+++ scribus/ui/reformdoc.cpp	(revision 14924)
@@ -141,10 +141,10 @@
 {
 	ApplicationPrefs* prefsData=&(PrefsManager::instance()->appPrefs);
 	tabPage->restoreDefaults(currDoc);
-	tabView->restoreDefaults(prefsData, currDoc->guidesSettings, currDoc->pageSets, currDoc->currentPageLayout, currDoc->scratch);
-	tabView->gapHorizontal->setValue(currDoc->GapHorizontal); // * unitRatio);
-	tabView->gapVertical->setValue(currDoc->GapVertical); // * unitRatio);
-	tabView->setPaperColor(currDoc->papColor);
+	tabView->restoreDefaults(prefsData, currDoc->guidesSettings, currDoc->currentPageLayout, *currDoc->scratch());
+	tabView->gapHorizontal->setValue(currDoc->pageGapHorizontal()); // * unitRatio);
+	tabView->gapVertical->setValue(currDoc->pageGapVertical()); // * unitRatio);
+	tabView->setPaperColor(currDoc->paperColor());
 	tabView->setMarginColored(currDoc->marginColored);
 	tabHyphenator->restoreDefaults(currDoc);
 	tabGuides->restoreDefaults(&currDoc->guidesSettings, &currDoc->typographicSettings, docUnitIndex);
@@ -182,7 +182,7 @@
 {
 	tabPage->marginGroup->setFacingPages(!(layout == singlePage));
 	tabPage->choosenLayout = layout;
-	tabPage->docLayout->firstPage->setCurrentIndex(currDoc->pageSets[tabPage->choosenLayout].FirstPage);
+	tabPage->docLayout->firstPage->setCurrentIndex(currDoc->pageSets()[tabPage->choosenLayout].FirstPage);
 //	tabView->gapHorizontal->setValue(currDoc->pageSets[tabPage->choosenLayout].GapHorizontal * unitRatio);
 //	tabView->gapVertical->setValue(currDoc->pageSets[tabPage->choosenLayout].GapBelow * unitRatio);
 //	tabView->gapHorizontal->setValue(currDoc->GapHorizontal * unitRatio);
@@ -222,10 +222,10 @@
 {
 	MarginStruct updatedMargins(tabPage->marginGroup->margins());
 	int fp = tabPage->choosenLayout;
-	currDoc->pageSets[fp].FirstPage = tabPage->docLayout->firstPage->currentIndex();
+	currDoc->setPageSetFirstPage(fp, tabPage->docLayout->firstPage->currentIndex());
 //	currDoc->pageSets[fp].GapHorizontal = tabView->gapHorizontal->value() / currDoc->unitRatio();
-	currDoc->GapVertical = tabView->gapVertical->value() / currDoc->unitRatio();
-	currDoc->GapHorizontal = tabView->gapHorizontal->value() / currDoc->unitRatio();
+	currDoc->setPageGapHorizontal(tabView->gapVertical->value() / currDoc->unitRatio());
+	currDoc->setPageGapVertical(tabView->gapHorizontal->value() / currDoc->unitRatio());
 //	currDoc->pageSets[fp].GapBelow = tabView->gapVertical->value() / currDoc->unitRatio();
 	//currDoc->FirstPnum = pageNumber->value();
 	currDoc->resetPage(updatedMargins, fp);
@@ -234,12 +234,13 @@
 	currDoc->pageWidth = tabPage->pageW;
 	currDoc->pageHeight = tabPage->pageH;
 	currDoc->marginPreset = tabPage->marginGroup->getMarginPreset();
-	double TopD = tabView->topScratch->value() / currDoc->unitRatio() - currDoc->scratch.Top;
-	double LeftD = tabView->leftScratch->value() / currDoc->unitRatio() - currDoc->scratch.Left;
-	currDoc->scratch.Bottom = tabView->bottomScratch->value() / currDoc->unitRatio();
-	currDoc->scratch.Left = tabView->leftScratch->value() / currDoc->unitRatio();
-	currDoc->scratch.Right = tabView->rightScratch->value() / currDoc->unitRatio();
-	currDoc->scratch.Top = tabView->topScratch->value() / currDoc->unitRatio();
+	double TopD = tabView->topScratch->value() / currDoc->unitRatio() - currDoc->scratch()->Top;
+	double LeftD = tabView->leftScratch->value() / currDoc->unitRatio() - currDoc->scratch()->Left;
+	currDoc->scratch()->set(tabView->topScratch->value() / currDoc->unitRatio(), tabView->leftScratch->value() / currDoc->unitRatio(), tabView->bottomScratch->value() / currDoc->unitRatio(), tabView->rightScratch->value() / currDoc->unitRatio());
+//	currDoc->scratch.Bottom = tabView->bottomScratch->value() / currDoc->unitRatio();
+//	currDoc->scratch.Left = tabView->leftScratch->value() / currDoc->unitRatio();
+//	currDoc->scratch.Right = tabView->rightScratch->value() / currDoc->unitRatio();
+//	currDoc->scratch.Top = tabView->topScratch->value() / currDoc->unitRatio();
 	currDoc->bleeds.Bottom = tabPage->marginGroup->bottomBleed();
 	currDoc->bleeds.Top = tabPage->marginGroup->topBleed();
 	currDoc->bleeds.Left = tabPage->marginGroup->leftBleed();
@@ -296,8 +297,8 @@
 			pp->initialMargins=updatedMargins;
 			pp->marginPreset=currDoc->marginPreset;
 		}
-		pp->setXOffset(currDoc->scratch.Left);
-		pp->setYOffset(currDoc->scratch.Top);
+		pp->setXOffset(currDoc->scratch()->Left);
+		pp->setYOffset(currDoc->scratch()->Top);
 	}
 	uint docItemsCount = currDoc->MasterItems.count();
 	for (uint ite = 0; ite < docItemsCount; ++ite)
@@ -308,7 +309,7 @@
 	}
 	currDoc->guidesSettings.guidePlacement = tabGuides->inBackground->isChecked();
 	currDoc->marginColored = tabView->checkUnprintable->isChecked();
-	currDoc->papColor = tabView->colorPaper;
+	currDoc->setPaperColor(tabView->colorPaper);
 	currDoc->guidesSettings.marginsShown = tabGuides->marginBox->isChecked();
 	currDoc->guidesSettings.showBleed = tabView->checkBleed->isChecked();
 	currDoc->guidesSettings.framesShown = tabView->checkFrame->isChecked();
@@ -444,7 +445,7 @@
 /*	FIXME: scribus determines dict by charstyle now, so this setting should go into the doc's default charstyle
 		currDoc->docHyphenator->slotNewDict(ScMW->GetLang(tabHyphenator->language->currentText()));
 */
-	currDoc->Language = tabHyphenator->getLanguage();
+	currDoc->setHyphLanguage(tabHyphenator->getLanguage());
 	
 	currDoc->docHyphenator->slotNewSettings(tabHyphenator->getWordLen(),
 											!tabHyphenator->getVerbose(),
Index: scribus/ui/masterpagepalette.cpp
===================================================================
--- scribus/ui/masterpagepalette.cpp	(revision 14923)
+++ scribus/ui/masterpagepalette.cpp	(revision 14924)
@@ -222,7 +222,7 @@
 		}
 		destination->initialMargins.Top = from->initialMargins.Top;
 		destination->initialMargins.Bottom = from->initialMargins.Bottom;
-		if (currentDoc->pageSets[currentDoc->currentPageLayout].Columns == 1)
+		if (currentDoc->pageSets()[currentDoc->currentPageLayout].Columns == 1)
 		{
 			destination->initialMargins.Left = from->initialMargins.Left;
 			destination->initialMargins.Right = from->initialMargins.Right;
Index: scribus/ui/hysettings.cpp
===================================================================
--- scribus/ui/hysettings.cpp	(revision 14923)
+++ scribus/ui/hysettings.cpp	(revision 14924)
@@ -63,11 +63,11 @@
 
 void HySettings::restoreDefaults(ScribusDoc *doc)
 {
-	verbose->setChecked(!doc->Automatic);
-	input->setChecked(doc->AutoCheck);
-	setCurrentComboItem(language, LanguageManager::instance()->getTransLangFromLang(doc->Language));
-	wordLen->setValue(doc->MinWordLen);
-	maxCount->setValue(doc->HyCount);
+	verbose->setChecked(!doc->hyphAutomatic());
+	input->setChecked(doc->hyphAutoCheck());
+	setCurrentComboItem(language, LanguageManager::instance()->getTransLangFromLang(doc->hyphLanguage()));
+	wordLen->setValue(doc->hyphMinimumWordLength());
+	maxCount->setValue(doc->hyphConsecutiveLines());
 	ignoreList->addItems(doc->docHyphenator->ignoredWords.toList());
 	ignoreList->sortItems();
 	exceptList->addItems(doc->docHyphenator->specialWords.values());
Index: scribus/ui/copypagetomasterpagedialog.h
===================================================================
--- scribus/ui/copypagetomasterpagedialog.h	(revision 14923)
+++ scribus/ui/copypagetomasterpagedialog.h	(revision 14924)
@@ -15,7 +15,7 @@
 {
 Q_OBJECT
 public:
-	CopyPageToMasterPageDialog(int existingMasterNamesCount, QStringList& pageLocations, int currentLocation = -1, QWidget *parent = 0);
+	CopyPageToMasterPageDialog(int existingMasterNamesCount, const QStringList& pageLocations, int currentLocation = -1, QWidget *parent = 0);
 	~CopyPageToMasterPageDialog();
 	
 	void values(QString &pageName, bool &copyAppliedMaster, int &pageLocation) const;
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp	(revision 14923)
+++ scribus/ui/propertiespalette.cpp	(revision 14924)
@@ -4639,7 +4639,7 @@
 {
 	if ((HaveDoc) && (HaveItem))
 	{
-		CurItem->doc()->Language = (m_ScMW->GetLang(langCombo->currentText()));
+		CurItem->doc()->setHyphLanguage(m_ScMW->GetLang(langCombo->currentText()));
 		emit DocChanged();
 	}
 }
Index: scribus/ui/copypagetomasterpagedialog.cpp
===================================================================
--- scribus/ui/copypagetomasterpagedialog.cpp	(revision 14923)
+++ scribus/ui/copypagetomasterpagedialog.cpp	(revision 14924)
@@ -10,7 +10,7 @@
 
 #include "copypagetomasterpagedialog.h"
 
-CopyPageToMasterPageDialog::CopyPageToMasterPageDialog(int existingMasterNamesCount, QStringList& pageLocations, int currentLocation, QWidget *parent)
+CopyPageToMasterPageDialog::CopyPageToMasterPageDialog(int existingMasterNamesCount, const QStringList& pageLocations, int currentLocation, QWidget *parent)
  : QDialog(parent)
 {
 	setupUi(this);
Index: scribus/ui/newtemp.cpp
===================================================================
--- scribus/ui/newtemp.cpp	(revision 14923)
+++ scribus/ui/newtemp.cpp	(revision 14924)
@@ -49,7 +49,8 @@
 		Layout3->setMargin( 0 );
 		Links = new QComboBox( this );
 		QStringList::Iterator pNames;
-		for(pNames = doc->pageSets[doc->currentPageLayout].pageNames.begin(); pNames != doc->pageSets[doc->currentPageLayout].pageNames.end(); ++pNames )
+		QList<PageSet> pageSet(doc->pageSets());
+		for(pNames = pageSet[doc->currentPageLayout].pageNames.begin(); pNames != pageSet[doc->currentPageLayout].pageNames.end(); ++pNames )
 		{
 			//Links->insertItem((*pNames));
 			Links->addItem(CommonStrings::translatePageSetLocString((*pNames)));
Index: scribus/ui/inspage.cpp
===================================================================
--- scribus/ui/inspage.cpp	(revision 14923)
+++ scribus/ui/inspage.cpp	(revision 14924)
@@ -85,7 +85,7 @@
 	else
 	{
 		int row = 0;
-		for (int mp = 0; mp < currentDoc->pageSets[currentDoc->currentPageLayout].pageNames.count(); ++mp)
+		for (int mp = 0; mp < currentDoc->pageSets()[currentDoc->currentPageLayout].pageNames.count(); ++mp)
 		{
 			QComboBox* pageData = new QComboBox(masterPageGroup);
 //			for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
@@ -108,7 +108,7 @@
 			}
 			else if (mp == 1)
 			{
-				if (currentDoc->pageSets[currentDoc->currentPageLayout].pageNames.count() > 2)
+				if (currentDoc->pageSets()[currentDoc->currentPageLayout].pageNames.count() > 2)
 				{
 					bool conNam = currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormalMiddle);
 					for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
@@ -143,7 +143,7 @@
 			}
 			else if (mp == 2)
 			{
-				if (currentDoc->pageSets[currentDoc->currentPageLayout].pageNames.count() > 3)
+				if (currentDoc->pageSets()[currentDoc->currentPageLayout].pageNames.count() > 3)
 				{
 					bool conNam = currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormalMiddle);
 					for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
@@ -192,7 +192,7 @@
 				if (currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormalRight))
 					setCurrentComboItem(pageData, CommonStrings::trMasterPageNormalRight);
 			}
-			QString transLabel = currentDoc->pageSets[currentDoc->currentPageLayout].pageNames[mp];
+			QString transLabel = currentDoc->pageSets()[currentDoc->currentPageLayout].pageNames[mp];
 			QLabel* pageLabel = new QLabel(CommonStrings::translatePageSetLocString(transLabel), masterPageGroup);
 			pageLabel->setBuddy(pageData);
 			masterPageLayout->addWidget(pageLabel, row, 0 );
Index: scribus/ui/smtextstyles.cpp
===================================================================
--- scribus/ui/smtextstyles.cpp	(revision 14923)
+++ scribus/ui/smtextstyles.cpp	(revision 14924)
@@ -228,7 +228,7 @@
 	ParagraphStyle p;
 	p.setDefaultStyle(false);
 	p.setName(s);
-	p.charStyle().setLanguage(doc_->Language);
+	p.charStyle().setLanguage(doc_->hyphLanguage());
 	tmpStyles_.create(p);
 	return s;
 }
@@ -1590,7 +1590,7 @@
 	c.setDefaultStyle(false);
 	c.setName(s);
 	// #7360  - rather here than in CharStyle constructor as we have a pointer to doc.
-	c.setLanguage(doc_->Language);
+	c.setLanguage(doc_->hyphLanguage());
 	tmpStyles_.create(c);
 	return s;
 }
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 14923)
+++ scribus/scribus.cpp	(revision 14924)
@@ -1423,7 +1423,7 @@
 					if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
 						pg--;
 					else
-						pg -= doc->pageSets[doc->currentPageLayout].Columns;
+						pg -= doc->pageSets()[doc->currentPageLayout].Columns;
 					if (pg > -1)
 						view->GotoPage(pg);
 				}
@@ -1439,7 +1439,7 @@
 					if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
 						pg++;
 					else
-						pg += doc->pageSets[doc->currentPageLayout].Columns;
+						pg += doc->pageSets()[doc->currentPageLayout].Columns;
 					if (pg < static_cast<int>(doc->Pages->count()))
 						view->GotoPage(pg);
 				}
@@ -1698,7 +1698,7 @@
 				pagesize = ps2.name();
 			}
 			doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->getMarginPreset());
-			doc->pageSets[facingPages].FirstPage = firstPage;
+			doc->setPageSetFirstPage(facingPages, firstPage);
 			doc->bleeds.Bottom = dia->bleedBottom();
 			doc->bleeds.Top = dia->bleedTop();
 			doc->bleeds.Left = dia->bleedLeft();
@@ -1780,7 +1780,7 @@
 		}
 		if (doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->getMarginPreset()))
 		{
-			doc->pageSets[facingPages].FirstPage = firstPage;
+			doc->setPageSetFirstPage(facingPages, firstPage);
 			doc->bleeds.Bottom = dia->bleedBottom();
 			doc->bleeds.Top = dia->bleedTop();
 			doc->bleeds.Left = dia->bleedLeft();
@@ -3408,17 +3408,16 @@
 bool ScribusMainWindow::slotDocOpen()
 {
 	PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false);
-	QString docDir = ".";
-	QString prefsDocDir=prefsManager->documentDir();
+	QString docDir(".");
+	QString prefsDocDir(prefsManager->documentDir());
 	if (!prefsDocDir.isEmpty())
 		docDir = docContext->get("docsopen", prefsDocDir);
 	else
 		docDir = docContext->get("docsopen", ".");
 	QString formats(FileLoader::getLoadFilterString());
 //	formats.remove("PDF (*.pdf *.PDF);;");
-	QString fileName = CFileDialog( docDir, tr("Open"), formats);
-	if (fileName.isEmpty())
-		// User cancelled
+	QString fileName(CFileDialog( docDir, tr("Open"), formats));
+	if (fileName.isEmpty()) // User cancelled
 		return false;
 	QFileInfo fi(fileName);
 	docContext->set("docsopen", fi.absolutePath());
@@ -3846,7 +3845,7 @@
 		else
 			doc->setName(FName);
 		doc->setMasterPageMode(false);
-		doc->Language = GetLang(doc->Language);
+		doc->setHyphLanguage(GetLang(doc->hyphLanguage()));
 		HaveNewDoc();
 //		propertiesPalette->Cpal->ChooseGrad(0);
 //		propertiesPalette->updateCList();
@@ -5413,7 +5412,7 @@
 			ss->set("BASED", basedOn->join("|"));
 		else
 		{
-			int setcol = doc->pageSets[doc->currentPageLayout].Columns;
+			int setcol = doc->pageSets()[doc->currentPageLayout].Columns;
 			if (setcol == 1)
 				ss->set("BASED", CommonStrings::trMasterPageNormal);
 			else if (setcol == 2)
@@ -5435,7 +5434,7 @@
 	QStringList base;
 	if (basedOn == NULL)
 	{
-		int setcol = doc->pageSets[doc->currentPageLayout].Columns;
+		int setcol = doc->pageSets()[doc->currentPageLayout].Columns;
 		if (setcol == 1)
 			base.append( CommonStrings::trMasterPageNormal);
 		else if (setcol == 2)
@@ -5469,7 +5468,7 @@
 	view->updatesOn(false);
 	for (cc = 0; cc < numPages; ++cc)
 	{
-		slotNewPage(wot, base[(wot+doc->pageSets[doc->currentPageLayout].FirstPage) % doc->pageSets[doc->currentPageLayout].Columns], mov); //Avoid the master page application with QString::null
+		slotNewPage(wot, base[(wot+doc->pageSets()[doc->currentPageLayout].FirstPage) % doc->pageSets()[doc->currentPageLayout].Columns], mov); //Avoid the master page application with QString::null
 //		slotNewPage(wot, QString::null, mov); //Avoid the master page application with QString::null
 		//CB: #8212: added overrideMasterPageSizing, but keeping default to true for other calls for now, off for calls from InsPage
 		if (overrideMasterPageSizing)
@@ -5531,7 +5530,8 @@
 	if (doc->currentPageLayout != singlePage)
 	{
 		QStringList locationEntries;
-		for(QStringList::Iterator pNames = doc->pageSets[doc->currentPageLayout].pageNames.begin(); pNames != doc->pageSets[doc->currentPageLayout].pageNames.end(); ++pNames )
+		QList<PageSet> pageSet(doc->pageSets());
+		for(QStringList::Iterator pNames = pageSet[doc->currentPageLayout].pageNames.begin(); pNames != pageSet[doc->currentPageLayout].pageNames.end(); ++pNames )
 		{
 			locationEntries << CommonStrings::translatePageSetLocString(*pNames);
 		}
@@ -5539,7 +5539,7 @@
 		pageLocationCount=locationEntries.count();
 	}
 
-	CopyPageToMasterPageDialog copyDialog(doc->MasterNames.count(), doc->pageSets[doc->currentPageLayout].pageNames, pageLocationIndex, this);
+	CopyPageToMasterPageDialog copyDialog(doc->MasterNames.count(), doc->pageSets()[doc->currentPageLayout].pageNames, pageLocationIndex, this);
 	if (copyDialog.exec())
 	{
 		bool copyFromMaster=false;
Index: scribus/plugins/scriptplugin/cmdpage.cpp
===================================================================
--- scribus/plugins/scriptplugin/cmdpage.cpp	(revision 14923)
+++ scribus/plugins/scriptplugin/cmdpage.cpp	(revision 14924)
@@ -117,7 +117,7 @@
 		return NULL;
 
 	int loc = (e > -1) ? e : ScCore->primaryMainWindow()->doc->Pages->count();
-	if (ScCore->primaryMainWindow()->doc->pageSets[ScCore->primaryMainWindow()->doc->currentPageLayout].Columns != 1)
+	if (ScCore->primaryMainWindow()->doc->pageSets()[ScCore->primaryMainWindow()->doc->currentPageLayout].Columns != 1)
 	{
 		switch (ScCore->primaryMainWindow()->doc->locationOfPage(loc))
 		{
@@ -386,7 +386,7 @@
 
 		QString qName(CommonStrings::trMasterPageNormal);
 
-		if (ScCore->primaryMainWindow()->doc->pageSets[ScCore->primaryMainWindow()->doc->currentPageLayout].Columns != 1) {
+		if (ScCore->primaryMainWindow()->doc->pageSets()[ScCore->primaryMainWindow()->doc->currentPageLayout].Columns != 1) {
 			ScCore->primaryMainWindow()->doc->locationOfPage(loc);
 			switch (ScCore->primaryMainWindow()->doc->locationOfPage(loc))
 			{
Index: scribus/plugins/scriptplugin/cmddoc.cpp
===================================================================
--- scribus/plugins/scriptplugin/cmddoc.cpp	(revision 14923)
+++ scribus/plugins/scriptplugin/cmddoc.cpp	(revision 14924)
@@ -68,7 +68,7 @@
 								0, 1, false,
 								pagesType, unit, firstPageOrder,
 								orientation, firstPageNr, "Custom", true, numPages);
-	ScCore->primaryMainWindow()->doc->pageSets[pagesType].FirstPage = firstPageOrder;
+	ScCore->primaryMainWindow()->doc->setPageSetFirstPage(pagesType, firstPageOrder);
 
 	return PyInt_FromLong(static_cast<long>(ret));
 }
@@ -283,7 +283,7 @@
 	if(!checkHaveDocument())
 		return NULL;
 	if (ScCore->primaryMainWindow()->doc->currentPageLayout == fp)
-		ScCore->primaryMainWindow()->doc->pageSets[ScCore->primaryMainWindow()->doc->currentPageLayout].FirstPage = fsl;
+		ScCore->primaryMainWindow()->doc->setPageSetFirstPage(ScCore->primaryMainWindow()->doc->currentPageLayout, fsl);
 	ScCore->primaryMainWindow()->view->reformPages();
 	ScCore->primaryMainWindow()->view->GotoPage(ScCore->primaryMainWindow()->doc->currentPageNumber()); // is this needed?
 	ScCore->primaryMainWindow()->view->DrawNew();   // is this needed?
Index: scribus/plugins/fileloader/scribus12format/scribus12format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus12format/scribus12format.cpp	(revision 14923)
+++ scribus/plugins/fileloader/scribus12format/scribus12format.cpp	(revision 14924)
@@ -289,7 +289,7 @@
 			fp = 1;
 		if (m_Doc->currentPageLayout == 0)
 			fp = 0;
-		m_Doc->pageSets[m_Doc->currentPageLayout].FirstPage = fp;
+		m_Doc->setPageSetFirstPage(m_Doc->currentPageLayout, fp);
 		m_Doc->setUsesAutomaticTextFrames(dc.attribute("AUTOTEXT").toInt());
 		m_Doc->PageSp=dc.attribute("AUTOSPALTEN").toInt();
 		m_Doc->PageSpa=ScCLocale::toDoubleC(dc.attribute("ABSTSPALTEN"));
@@ -353,11 +353,11 @@
 		m_Doc->CMSSettings.DefaultIntentColors = (eRenderIntent) dc.attribute("DISc", "1").toInt();
 		m_Doc->CMSSettings.DefaultIntentImages = (eRenderIntent) dc.attribute("DIIm", "0").toInt();
 		activeLayer = dc.attribute("ALAYER", "0").toInt();
-		m_Doc->Language = dc.attribute("LANGUAGE", "");
-		m_Doc->MinWordLen = dc.attribute("MINWORDLEN", "3").toInt();
-		m_Doc->HyCount = dc.attribute("HYCOUNT", "2").toInt();
-		m_Doc->Automatic = static_cast<bool>(dc.attribute("AUTOMATIC", "1").toInt());
-		m_Doc->AutoCheck = static_cast<bool>(dc.attribute("AUTOCHECK", "0").toInt());
+		m_Doc->setHyphLanguage(dc.attribute("LANGUAGE", ""));
+		m_Doc->setHyphMinimumWordLength(dc.attribute("MINWORDLEN", "3").toInt());
+		m_Doc->setHyphConsecutiveLines(dc.attribute("HYCOUNT", "2").toInt());
+		m_Doc->setHyphAutomatic(static_cast<bool>(dc.attribute("AUTOMATIC", "1").toInt()));
+		m_Doc->setHyphAutoCheck(static_cast<bool>(dc.attribute("AUTOCHECK", "0").toInt()));
 		m_Doc->GuideLock = static_cast<bool>(dc.attribute("GUIDELOCK", "0").toInt());
 		m_Doc->SnapGuides = static_cast<bool>(dc.attribute("SnapToGuides", "0").toInt());
 		m_Doc->useRaster = static_cast<bool>(dc.attribute("SnapToGrid", "0").toInt());
@@ -506,7 +506,7 @@
 					m_AvailableFonts->findFont(tmpf, m_Doc);
 					OB.IFont = tmpf;
 					OB.LayerID = obj.attribute("LAYER", "0").toInt();
-					OB.Language = obj.attribute("LANGUAGE", m_Doc->Language);
+					OB.Language = obj.attribute("LANGUAGE", m_Doc->hyphLanguage());
 					tmp = "";
 					if ((obj.hasAttribute("GROUPS")) && (obj.attribute("NUMGROUP", "0").toInt() != 0))
 					{
@@ -1384,7 +1384,7 @@
 					m_AvailableFonts->findFont(tmpf, m_Doc);
 					OB.IFont = tmpf;
 					OB.LayerID = layerTrans[obj.attribute("LAYER", "0").toInt()];
-					OB.Language = obj.attribute("LANGUAGE", m_Doc->Language);
+					OB.Language = obj.attribute("LANGUAGE", m_Doc->hyphLanguage());
 					tmp = "";
 					if ((obj.hasAttribute("GROUPS")) && (obj.attribute("NUMGROUP", "0").toInt() != 0))
 					{
Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus13format/scribus13format.cpp	(revision 14923)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp	(revision 14924)
@@ -261,7 +261,7 @@
 		}
 		if (DOC.namedItem("PageSets").isNull())
 		{
-			m_Doc->pageSets[m_Doc->currentPageLayout].FirstPage = fp;
+			m_Doc->setPageSetFirstPage(m_Doc->currentPageLayout, fp);
 //			m_Doc->pageSets[m_Doc->currentPageLayout].GapHorizontal = dc.attribute("GapHorizontal", "0").toDouble();
 //			m_Doc->pageSets[m_Doc->currentPageLayout].GapVertical = 0.0;
 //			m_Doc->pageSets[m_Doc->currentPageLayout].GapBelow = dc.attribute("GapVertical", "40").toDouble();
@@ -326,9 +326,9 @@
 		m_Doc->CMSSettings.DefaultIntentColors = (eRenderIntent) dc.attribute("DISc", "1").toInt();
 		m_Doc->CMSSettings.DefaultIntentImages = (eRenderIntent) dc.attribute("DIIm", "0").toInt();
 		layerToSetActive=dc.attribute("ALAYER", "0").toInt();
-		m_Doc->Language = dc.attribute("LANGUAGE", "");
-		m_Doc->MinWordLen = dc.attribute("MINWORDLEN", "3").toInt();
-		m_Doc->HyCount = dc.attribute("HYCOUNT", "2").toInt();
+		m_Doc->setHyphLanguage(dc.attribute("LANGUAGE", ""));
+		m_Doc->setHyphMinimumWordLength(dc.attribute("MINWORDLEN", "3").toInt());
+		m_Doc->setHyphConsecutiveLines(dc.attribute("HYCOUNT", "2").toInt());
 		if (dc.hasAttribute("PAGEWIDTH"))
 			m_Doc->pageWidth = ScCLocale::toDoubleC(dc.attribute("PAGEWIDTH"));
 		else
@@ -339,8 +339,8 @@
 		m_Doc->pageMargins.Top   = qMax(0.0, ScCLocale::toDoubleC("BORDERTOP"));
 		m_Doc->pageMargins.Bottom= qMax(0.0, ScCLocale::toDoubleC("BORDERBOTTOM"));
 		m_Doc->marginPreset = dc.attribute("PRESET", "0").toInt();
-		m_Doc->Automatic = static_cast<bool>(dc.attribute("AUTOMATIC", "1").toInt());
-		m_Doc->AutoCheck = static_cast<bool>(dc.attribute("AUTOCHECK", "0").toInt());
+		m_Doc->setHyphAutomatic(static_cast<bool>(dc.attribute("AUTOMATIC", "1").toInt()));
+		m_Doc->setHyphAutoCheck(static_cast<bool>(dc.attribute("AUTOCHECK", "0").toInt()));
 		m_Doc->GuideLock = static_cast<bool>(dc.attribute("GUIDELOCK", "0").toInt());
 		m_Doc->guidesSettings.minorGridSpacing = ScCLocale::toDoubleC(dc.attribute("MINGRID"), prefsManager->appPrefs.guidesPrefs.minorGridSpacing);
 		m_Doc->guidesSettings.majorGridSpacing = ScCLocale::toDoubleC(dc.attribute("MAJGRID"), prefsManager->appPrefs.guidesPrefs.majorGridSpacing);
@@ -368,15 +368,15 @@
 		m_Doc->itemToolPrefs.polyUseFactor = static_cast<bool>(dc.attribute("POLYS", "0").toInt());
 		m_Doc->AutoSave = static_cast<bool>(dc.attribute("AutoSave", "0").toInt());
 		m_Doc->AutoSaveTime = dc.attribute("AutoSaveTime", "600000").toInt();
-		m_Doc->scratch.Bottom = ScCLocale::toDoubleC(dc.attribute("ScratchBottom"), 20.0);
+		double leftScratch;
 		// FIXME A typo in early 1.3cvs (MAR 05) means we must support loading of
 		// FIXME 'ScatchLeft' for a while too. This can be removed in a few months.
 		if (dc.hasAttribute("ScatchLeft"))
-			m_Doc->scratch.Left = ScCLocale::toDoubleC(dc.attribute("ScatchLeft"), 100.0);
+			leftScratch = ScCLocale::toDoubleC(dc.attribute("ScatchLeft"), 100.0);
 		else
-			m_Doc->scratch.Left = ScCLocale::toDoubleC(dc.attribute("ScratchLeft"), 100.0);
-		m_Doc->scratch.Right = ScCLocale::toDoubleC(dc.attribute("ScratchRight"), 100.0);
-		m_Doc->scratch.Top   = ScCLocale::toDoubleC(dc.attribute("ScratchTop"), 20.0);
+			leftScratch = ScCLocale::toDoubleC(dc.attribute("ScratchLeft"), 100.0);
+		m_Doc->scratch()->set(ScCLocale::toDoubleC(dc.attribute("ScratchTop"), 20.0), leftScratch,
+							  ScCLocale::toDoubleC(dc.attribute("ScratchBottom"), 20.0), ScCLocale::toDoubleC(dc.attribute("ScratchRight"), 100.0));
 		m_Doc->itemToolPrefs.lineStartArrow = dc.attribute("StartArrow", "0").toInt();
 		m_Doc->itemToolPrefs.lineEndArrow = dc.attribute("EndArrow", "0").toInt();
 		m_Doc->itemToolPrefs.imageScaleX = ScCLocale::toDoubleC(dc.attribute("PICTSCX"), 1.0);
@@ -420,7 +420,7 @@
 			m_Doc->itemToolPrefs.imageFillColor = dc.attribute("CPICT");
 		m_Doc->itemToolPrefs.imageFillColorShade = ScCLocale::toDoubleC(dc.attribute("PICTSHADE"), 100.0);
 		if (dc.hasAttribute("PAGEC"))
-			m_Doc->papColor = QColor(dc.attribute("PAGEC"));
+			m_Doc->setPaperColor(QColor(dc.attribute("PAGEC")));
 		if (dc.hasAttribute("MARGC"))
 			m_Doc->guidesSettings.marginColor = QColor(dc.attribute("MARGC"));
 		if (dc.hasAttribute("MINORC"))
@@ -452,7 +452,7 @@
 			if (pg.tagName()=="PageSets")
 			{
 				QDomNode PGS = PAGE.firstChild();
-				m_Doc->pageSets.clear();
+				m_Doc->clearPageSets();
 				while(!PGS.isNull())
 				{
 					QDomElement PgsAttr = PGS.toElement();
@@ -475,11 +475,12 @@
 								pageS.pageNames.append(CommonStrings::untranslatePageSetLocString(PgsAttrN.attribute("Name")));
 							PGSN = PGSN.nextSibling();
 						}
-						m_Doc->pageSets.append(pageS);
-						if (m_Doc->pageSets.count()-1 == m_Doc->currentPageLayout)
+						//->Prefs m_Doc->pageSets.append(pageS);
+						m_Doc->appendToPageSets(pageS);
+						if (m_Doc->pageSets().count()-1 == m_Doc->currentPageLayout)
 						{
-							m_Doc->GapHorizontal = ScCLocale::toDoubleC(PgsAttr.attribute("GapHorizontal"), 0.0);
-							m_Doc->GapVertical   = ScCLocale::toDoubleC(PgsAttr.attribute("GapBelow"), 0.0);
+							m_Doc->setPageGapHorizontal(ScCLocale::toDoubleC(PgsAttr.attribute("GapHorizontal"), 0.0));
+							m_Doc->setPageGapVertical(ScCLocale::toDoubleC(PgsAttr.attribute("GapBelow"), 0.0));
 						}
 					}
 					PGS = PGS.nextSibling();
@@ -1251,11 +1252,11 @@
 	dc.setAttribute("DISc",m_Doc->CMSSettings.DefaultIntentColors);
 	dc.setAttribute("DIIm",m_Doc->CMSSettings.DefaultIntentImages);
 	dc.setAttribute("ALAYER", m_Doc->activeLayer());
-	dc.setAttribute("LANGUAGE", m_Doc->Language);
-	dc.setAttribute("MINWORDLEN", m_Doc->MinWordLen);
-	dc.setAttribute("HYCOUNT", m_Doc->HyCount);
-	dc.setAttribute("AUTOMATIC", static_cast<int>(m_Doc->Automatic));
-	dc.setAttribute("AUTOCHECK", static_cast<int>(m_Doc->AutoCheck));
+	dc.setAttribute("LANGUAGE", m_Doc->hyphLanguage());
+	dc.setAttribute("MINWORDLEN", m_Doc->hyphMinimumWordLength());
+	dc.setAttribute("HYCOUNT", m_Doc->hyphConsecutiveLines());
+	dc.setAttribute("AUTOMATIC", static_cast<int>(m_Doc->hyphAutomatic()));
+	dc.setAttribute("AUTOCHECK", static_cast<int>(m_Doc->hyphAutoCheck()));
 	dc.setAttribute("GUIDELOCK", static_cast<int>(m_Doc->GuideLock));
 	dc.setAttribute("SnapToGuides", static_cast<int>(m_Doc->SnapGuides));
 	dc.setAttribute("SnapToGrid", static_cast<int>(m_Doc->useRaster));
@@ -1284,10 +1285,10 @@
 	dc.setAttribute("POLYS", static_cast<int>(m_Doc->itemToolPrefs.polyUseFactor));
 	dc.setAttribute("AutoSave", static_cast<int>(m_Doc->AutoSave));
 	dc.setAttribute("AutoSaveTime", m_Doc->AutoSaveTime);
-	dc.setAttribute("ScratchBottom", m_Doc->scratch.Bottom);
-	dc.setAttribute("ScratchLeft", m_Doc->scratch.Left);
-	dc.setAttribute("ScratchRight", m_Doc->scratch.Right);
-	dc.setAttribute("ScratchTop", m_Doc->scratch.Top);
+	dc.setAttribute("ScratchBottom", m_Doc->scratch()->Bottom);
+	dc.setAttribute("ScratchLeft", m_Doc->scratch()->Left);
+	dc.setAttribute("ScratchRight", m_Doc->scratch()->Right);
+	dc.setAttribute("ScratchTop", m_Doc->scratch()->Top);
 	dc.setAttribute("StartArrow", m_Doc->itemToolPrefs.lineStartArrow);
 	dc.setAttribute("EndArrow", m_Doc->itemToolPrefs.lineEndArrow);
 	dc.setAttribute("PEN",m_Doc->itemToolPrefs.shapeLineColor);
@@ -1325,7 +1326,7 @@
 	dc.setAttribute("BaseC", m_Doc->guidesSettings.baselineGridColor.name());
 	dc.setAttribute("GuideZ", m_Doc->guidesSettings.guideRad);
 	dc.setAttribute("BACKG", static_cast<int>(m_Doc->guidesSettings.guidePlacement));
-	dc.setAttribute("PAGEC",m_Doc->papColor.name());
+	dc.setAttribute("PAGEC",m_Doc->paperColor().name());
 	dc.setAttribute("MARGC",m_Doc->guidesSettings.marginColor.name());
 	dc.setAttribute("RANDF", static_cast<int>(m_Doc->marginColored));
 	dc.setAttribute("currentProfile", m_Doc->curCheckProfile);
@@ -1656,7 +1657,8 @@
 
 	QDomElement pageSetAttr = docu.createElement("PageSets");
 	QList<PageSet>::Iterator itpgset;
-	for(itpgset = m_Doc->pageSets.begin(); itpgset != m_Doc->pageSets.end(); ++itpgset )
+	QList<PageSet> pageSet(m_Doc->pageSets());
+	for(itpgset = pageSet.begin(); itpgset != pageSet.end(); ++itpgset )
 	{
 		QDomElement pgst = docu.createElement("Set");
 		pgst.setAttribute("Name", (*itpgset).Name);
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(revision 14923)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(revision 14924)
@@ -150,11 +150,11 @@
 	docu.writeAttribute("DISc",m_Doc->CMSSettings.DefaultIntentColors);
 	docu.writeAttribute("DIIm",m_Doc->CMSSettings.DefaultIntentImages);
 	docu.writeAttribute("ALAYER", m_Doc->activeLayer());
-	docu.writeAttribute("LANGUAGE", m_Doc->Language);
-	docu.writeAttribute("MINWORDLEN", m_Doc->MinWordLen);
-	docu.writeAttribute("HYCOUNT", m_Doc->HyCount);
-	docu.writeAttribute("AUTOMATIC", static_cast<int>(m_Doc->Automatic));
-	docu.writeAttribute("AUTOCHECK", static_cast<int>(m_Doc->AutoCheck));
+	docu.writeAttribute("LANGUAGE", m_Doc->hyphLanguage());
+	docu.writeAttribute("MINWORDLEN", m_Doc->hyphMinimumWordLength());
+	docu.writeAttribute("HYCOUNT", m_Doc->hyphConsecutiveLines());
+	docu.writeAttribute("AUTOMATIC", static_cast<int>(m_Doc->hyphAutomatic()));
+	docu.writeAttribute("AUTOCHECK", static_cast<int>(m_Doc->hyphAutoCheck()));
 	docu.writeAttribute("GUIDELOCK", static_cast<int>(m_Doc->GuideLock));
 	docu.writeAttribute("SnapToGuides", static_cast<int>(m_Doc->SnapGuides));
 	docu.writeAttribute("SnapToGrid", static_cast<int>(m_Doc->useRaster));
@@ -185,12 +185,12 @@
 	docu.writeAttribute("POLYS", static_cast<int>(m_Doc->itemToolPrefs.polyUseFactor));
 	docu.writeAttribute("AutoSave", static_cast<int>(m_Doc->AutoSave));
 	docu.writeAttribute("AutoSaveTime", m_Doc->AutoSaveTime);
-	docu.writeAttribute("ScratchBottom", m_Doc->scratch.Bottom);
-	docu.writeAttribute("ScratchLeft", m_Doc->scratch.Left);
-	docu.writeAttribute("ScratchRight", m_Doc->scratch.Right);
-	docu.writeAttribute("ScratchTop", m_Doc->scratch.Top);
-	docu.writeAttribute("GapHorizontal", m_Doc->GapHorizontal);
-	docu.writeAttribute("GapVertical", m_Doc->GapVertical);
+	docu.writeAttribute("ScratchBottom", m_Doc->scratch()->Bottom);
+	docu.writeAttribute("ScratchLeft", m_Doc->scratch()->Left);
+	docu.writeAttribute("ScratchRight", m_Doc->scratch()->Right);
+	docu.writeAttribute("ScratchTop", m_Doc->scratch()->Top);
+	docu.writeAttribute("GapHorizontal", m_Doc->pageGapHorizontal());
+	docu.writeAttribute("GapVertical", m_Doc->pageGapVertical());
 	docu.writeAttribute("StartArrow", m_Doc->itemToolPrefs.lineStartArrow);
 	docu.writeAttribute("EndArrow", m_Doc->itemToolPrefs.lineEndArrow);
 	docu.writeAttribute("PEN",m_Doc->itemToolPrefs.shapeLineColor);
@@ -231,7 +231,7 @@
 	docu.writeAttribute("BaseC", m_Doc->guidesSettings.baselineGridColor.name());
 	docu.writeAttribute("GuideZ", m_Doc->guidesSettings.guideRad);
 	docu.writeAttribute("BACKG", static_cast<int>(m_Doc->guidesSettings.guidePlacement));
-	docu.writeAttribute("PAGEC",m_Doc->papColor.name());
+	docu.writeAttribute("PAGEC",m_Doc->paperColor().name());
 	docu.writeAttribute("MARGC",m_Doc->guidesSettings.marginColor.name());
 	docu.writeAttribute("RANDF", static_cast<int>(m_Doc->marginColored));
 	docu.writeAttribute("currentProfile", m_Doc->curCheckProfile);
@@ -851,7 +851,8 @@
 {	
 	docu.writeStartElement("PageSets");
 	QList<PageSet>::Iterator itpgset;
-	for(itpgset = m_Doc->pageSets.begin(); itpgset != m_Doc->pageSets.end(); ++itpgset )
+	QList<PageSet> pageSet(m_Doc->pageSets());
+	for(itpgset = pageSet.begin(); itpgset != pageSet.end(); ++itpgset )
 	{
 		docu.writeStartElement("Set");
 		docu.writeAttribute("Name", (*itpgset).Name);
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 14923)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 14924)
@@ -570,7 +570,8 @@
 	//Will of course be replaced by per page settings although we still probably need a document default
 	if (!hasPageSets)
 	{
-		m_Doc->pageSets[m_Doc->currentPageLayout].FirstPage = firstPage;
+		m_Doc->setPageSetFirstPage(m_Doc->currentPageLayout, firstPage);
+//->Prefs		m_Doc->pageSets[m_Doc->currentPageLayout].FirstPage = firstPage;
 //		m_Doc->pageSets[m_Doc->currentPageLayout].GapHorizontal = dc.attribute("GapHorizontal", "0").toDouble();
 //		m_Doc->pageSets[m_Doc->currentPageLayout].GapVertical = 0.0;
 //		m_Doc->pageSets[m_Doc->currentPageLayout].GapBelow = dc.attribute("GapVertical", "40").toDouble();
@@ -742,9 +743,9 @@
 	m_Doc->PageSpa = attrs.valueAsDouble("ABSTSPALTEN");
 	m_Doc->setUnitIndex( attrs.valueAsInt("UNITS", 0) );
 
-	m_Doc->Language   = attrs.valueAsString("LANGUAGE", "");
-	m_Doc->MinWordLen = attrs.valueAsInt("MINWORDLEN", 3);
-	m_Doc->HyCount    = attrs.valueAsInt("HYCOUNT", 2);
+	m_Doc->setHyphLanguage(attrs.valueAsString("LANGUAGE", ""));
+	m_Doc->setHyphMinimumWordLength(attrs.valueAsInt("MINWORDLEN", 3));
+	m_Doc->setHyphConsecutiveLines(attrs.valueAsInt("HYCOUNT", 2));
 
 	if (attrs.hasAttribute("PAGEWIDTH"))
 		m_Doc->pageWidth = attrs.valueAsDouble("PAGEWIDTH");
@@ -760,8 +761,8 @@
 	m_Doc->bleeds.Left   = attrs.valueAsDouble("BleedLeft", 0.0);
 	m_Doc->bleeds.Right  = attrs.valueAsDouble("BleedRight", 0.0);
 	m_Doc->bleeds.Bottom = attrs.valueAsDouble("BleedBottom", 0.0);
-	m_Doc->Automatic = attrs.valueAsBool("AUTOMATIC", true);
-	m_Doc->AutoCheck = attrs.valueAsBool("AUTOCHECK", false);
+	m_Doc->setHyphAutomatic(attrs.valueAsBool("AUTOMATIC", true));
+	m_Doc->setHyphAutoCheck(attrs.valueAsBool("AUTOCHECK", false));
 	m_Doc->GuideLock = attrs.valueAsBool("GUIDELOCK", false);
 	
 	m_Doc->rulerXoffset = attrs.valueAsDouble("rulerXoffset", 0.0);
@@ -771,20 +772,21 @@
 	
 	m_Doc->AutoSave       = attrs.valueAsBool("AutoSave", false);
 	m_Doc->AutoSaveTime   = attrs.valueAsInt("AutoSaveTime", 600000);
-	m_Doc->scratch.Bottom = attrs.valueAsDouble("ScratchBottom", 20.0);
+	double leftScratch;
 	// FIXME A typo in early 1.3cvs (MAR 05) means we must support loading of
 	// FIXME 'ScatchLeft' for a while too. This can be removed in a few months.
 	if (attrs.hasAttribute("ScatchLeft"))
-		m_Doc->scratch.Left = attrs.valueAsDouble("ScatchLeft", 100.0);
+		leftScratch = attrs.valueAsDouble("ScatchLeft", 100.0);
 	else
-		m_Doc->scratch.Left = attrs.valueAsDouble("ScratchLeft", 100.0);
-	m_Doc->scratch.Right = attrs.valueAsDouble("ScratchRight", 100.0);
-	m_Doc->scratch.Top   = attrs.valueAsDouble("ScratchTop", 20.0);
-	m_Doc->GapHorizontal = attrs.valueAsDouble("GapHorizontal", -1.0);
-	m_Doc->GapVertical   = attrs.valueAsDouble("GapVertical", -1.0);
+		leftScratch = attrs.valueAsDouble("ScratchLeft", 100.0);
+	m_Doc->scratch()->set(attrs.valueAsDouble("ScratchTop", 20.0), leftScratch,
+						  attrs.valueAsDouble("ScratchBottom", 20.0),attrs.valueAsDouble("ScratchRight", 100.0));
+	m_Doc->setPageGapHorizontal(attrs.valueAsDouble("GapHorizontal", -1.0));
+	m_Doc->setPageGapVertical(attrs.valueAsDouble("GapVertical", -1.0));
 	
 	if (attrs.hasAttribute("PAGEC"))
-		m_Doc->papColor = QColor(attrs.valueAsString("PAGEC"));
+		m_Doc->setPaperColor(QColor(attrs.valueAsString("PAGEC")));
+		//->Prefs m_Doc->papColor = QColor(attrs.valueAsString("PAGEC"));
 	
 	m_Doc->marginColored = attrs.valueAsBool("RANDF", false);
 
@@ -953,7 +955,7 @@
 	struct PageSet pageS;
 	ScXmlStreamAttributes attrs;
 
-	doc->pageSets.clear();
+	doc->clearPageSets();
 	while(!reader.atEnd() && !reader.hasError())
 	{
 		reader.readNext();
@@ -976,11 +978,12 @@
 		}
 		if(reader.isEndElement() && tagName == "Set")
 		{
-			doc->pageSets.append(pageS);
-			if ((doc->pageSets.count()-1 == doc->currentPageLayout) && ((doc->GapHorizontal < 0) && (doc->GapVertical < 0)))
+//			doc->pageSets.append(pageS);
+			doc->appendToPageSets(pageS);
+			if ((doc->pageSets().count()-1 == doc->currentPageLayout) && ((doc->pageGapHorizontal() < 0) && (doc->pageGapVertical() < 0)))
 			{
-				doc->GapHorizontal = attrs.valueAsDouble("GapHorizontal", 0.0);
-				doc->GapVertical   = attrs.valueAsDouble("GapBelow", 0.0);
+				doc->setPageGapHorizontal(attrs.valueAsDouble("GapHorizontal", 0.0));
+				doc->setPageGapVertical(attrs.valueAsDouble("GapBelow", 0.0));
 			}
 		}
 		if (reader.isStartElement() && tagName == "PageNames")
Index: scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp	(revision 14923)
+++ scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp	(revision 14924)
@@ -147,11 +147,11 @@
 	docu.writeAttribute("DISc",m_Doc->CMSSettings.DefaultIntentColors);
 	docu.writeAttribute("DIIm",m_Doc->CMSSettings.DefaultIntentImages);
 	docu.writeAttribute("ALAYER", m_Doc->activeLayer());
-	docu.writeAttribute("LANGUAGE", m_Doc->Language);
-	docu.writeAttribute("MINWORDLEN", m_Doc->MinWordLen);
-	docu.writeAttribute("HYCOUNT", m_Doc->HyCount);
-	docu.writeAttribute("AUTOMATIC", static_cast<int>(m_Doc->Automatic));
-	docu.writeAttribute("AUTOCHECK", static_cast<int>(m_Doc->AutoCheck));
+	docu.writeAttribute("LANGUAGE", m_Doc->hyphLanguage());
+	docu.writeAttribute("MINWORDLEN", m_Doc->hyphMinimumWordLength());
+	docu.writeAttribute("HYCOUNT", m_Doc->hyphConsecutiveLines());
+	docu.writeAttribute("AUTOMATIC", static_cast<int>(m_Doc->hyphAutomatic()));
+	docu.writeAttribute("AUTOCHECK", static_cast<int>(m_Doc->hyphAutoCheck()));
 	docu.writeAttribute("GUIDELOCK", static_cast<int>(m_Doc->GuideLock));
 	docu.writeAttribute("SnapToGuides", static_cast<int>(m_Doc->SnapGuides));
 	docu.writeAttribute("SnapToGrid", static_cast<int>(m_Doc->useRaster));
@@ -182,12 +182,12 @@
 	docu.writeAttribute("POLYS", static_cast<int>(m_Doc->itemToolPrefs.polyUseFactor));
 	docu.writeAttribute("AutoSave", static_cast<int>(m_Doc->AutoSave));
 	docu.writeAttribute("AutoSaveTime", m_Doc->AutoSaveTime);
-	docu.writeAttribute("ScratchBottom", m_Doc->scratch.Bottom);
-	docu.writeAttribute("ScratchLeft", m_Doc->scratch.Left);
-	docu.writeAttribute("ScratchRight", m_Doc->scratch.Right);
-	docu.writeAttribute("ScratchTop", m_Doc->scratch.Top);
-	docu.writeAttribute("GapHorizontal", m_Doc->GapHorizontal);
-	docu.writeAttribute("GapVertical", m_Doc->GapVertical);
+	docu.writeAttribute("ScratchBottom", m_Doc->scratch()->Bottom);
+	docu.writeAttribute("ScratchLeft", m_Doc->scratch()->Left);
+	docu.writeAttribute("ScratchRight", m_Doc->scratch()->Right);
+	docu.writeAttribute("ScratchTop", m_Doc->scratch()->Top);
+	docu.writeAttribute("GapHorizontal", m_Doc->pageGapHorizontal());
+	docu.writeAttribute("GapVertical", m_Doc->pageGapVertical());
 	docu.writeAttribute("StartArrow", m_Doc->itemToolPrefs.lineStartArrow);
 	docu.writeAttribute("EndArrow", m_Doc->itemToolPrefs.lineEndArrow);
 	docu.writeAttribute("PEN",m_Doc->itemToolPrefs.shapeLineColor);
@@ -228,7 +228,7 @@
 	docu.writeAttribute("BaseC", m_Doc->guidesSettings.baselineGridColor.name());
 	docu.writeAttribute("GuideZ", m_Doc->guidesSettings.guideRad);
 	docu.writeAttribute("BACKG", static_cast<int>(m_Doc->guidesSettings.guidePlacement));
-	docu.writeAttribute("PAGEC",m_Doc->papColor.name());
+	docu.writeAttribute("PAGEC",m_Doc->paperColor().name());
 	docu.writeAttribute("MARGC",m_Doc->guidesSettings.marginColor.name());
 	docu.writeAttribute("RANDF", static_cast<int>(m_Doc->marginColored));
 	docu.writeAttribute("currentProfile", m_Doc->curCheckProfile);
@@ -827,7 +827,8 @@
 {	
 	docu.writeStartElement("PageSets");
 	QList<PageSet>::Iterator itpgset;
-	for(itpgset = m_Doc->pageSets.begin(); itpgset != m_Doc->pageSets.end(); ++itpgset )
+	QList<PageSet> pageSet(m_Doc->pageSets());
+	for(itpgset = pageSet.begin(); itpgset != pageSet.end(); ++itpgset )
 	{
 		docu.writeStartElement("Set");
 		docu.writeAttribute("Name", (*itpgset).Name);
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(revision 14923)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(revision 14924)
@@ -559,7 +559,8 @@
 	//Will of course be replaced by per page settings although we still probably need a document default
 	if (!hasPageSets)
 	{
-		m_Doc->pageSets[m_Doc->currentPageLayout].FirstPage = firstPage;
+		m_Doc->setPageSetFirstPage(m_Doc->currentPageLayout, firstPage);
+//->Prefs		m_Doc->pageSets[m_Doc->currentPageLayout].FirstPage = firstPage;
 //		m_Doc->pageSets[m_Doc->currentPageLayout].GapHorizontal = dc.attribute("GapHorizontal", "0").toDouble();
 //		m_Doc->pageSets[m_Doc->currentPageLayout].GapVertical = 0.0;
 //		m_Doc->pageSets[m_Doc->currentPageLayout].GapBelow = dc.attribute("GapVertical", "40").toDouble();
@@ -737,9 +738,9 @@
 	m_Doc->PageSpa = attrs.valueAsDouble("ABSTSPALTEN");
 	m_Doc->setUnitIndex( attrs.valueAsInt("UNITS", 0) );
 
-	m_Doc->Language   = attrs.valueAsString("LANGUAGE", "");
-	m_Doc->MinWordLen = attrs.valueAsInt("MINWORDLEN", 3);
-	m_Doc->HyCount    = attrs.valueAsInt("HYCOUNT", 2);
+	m_Doc->setHyphLanguage(attrs.valueAsString("LANGUAGE", ""));
+	m_Doc->setHyphMinimumWordLength(attrs.valueAsInt("MINWORDLEN", 3));
+	m_Doc->setHyphConsecutiveLines(attrs.valueAsInt("HYCOUNT", 2));
 
 	if (attrs.hasAttribute("PAGEWIDTH"))
 		m_Doc->pageWidth = attrs.valueAsDouble("PAGEWIDTH");
@@ -755,8 +756,8 @@
 	m_Doc->bleeds.Left   = attrs.valueAsDouble("BleedLeft", 0.0);
 	m_Doc->bleeds.Right  = attrs.valueAsDouble("BleedRight", 0.0);
 	m_Doc->bleeds.Bottom = attrs.valueAsDouble("BleedBottom", 0.0);
-	m_Doc->Automatic = attrs.valueAsBool("AUTOMATIC", true);
-	m_Doc->AutoCheck = attrs.valueAsBool("AUTOCHECK", false);
+	m_Doc->setHyphAutomatic(attrs.valueAsBool("AUTOMATIC", true));
+	m_Doc->setHyphAutoCheck(attrs.valueAsBool("AUTOCHECK", false));
 	m_Doc->GuideLock = attrs.valueAsBool("GUIDELOCK", false);
 	
 	m_Doc->rulerXoffset = attrs.valueAsDouble("rulerXoffset", 0.0);
@@ -766,20 +767,21 @@
 	
 	m_Doc->AutoSave       = attrs.valueAsBool("AutoSave", false);
 	m_Doc->AutoSaveTime   = attrs.valueAsInt("AutoSaveTime", 600000);
-	m_Doc->scratch.Bottom = attrs.valueAsDouble("ScratchBottom", 20.0);
+
+	double leftScratch;
 	// FIXME A typo in early 1.3cvs (MAR 05) means we must support loading of
 	// FIXME 'ScatchLeft' for a while too. This can be removed in a few months.
 	if (attrs.hasAttribute("ScatchLeft"))
-		m_Doc->scratch.Left = attrs.valueAsDouble("ScatchLeft", 100.0);
+		leftScratch = attrs.valueAsDouble("ScatchLeft", 100.0);
 	else
-		m_Doc->scratch.Left = attrs.valueAsDouble("ScratchLeft", 100.0);
-	m_Doc->scratch.Right = attrs.valueAsDouble("ScratchRight", 100.0);
-	m_Doc->scratch.Top   = attrs.valueAsDouble("ScratchTop", 20.0);
-	m_Doc->GapHorizontal = attrs.valueAsDouble("GapHorizontal", -1.0);
-	m_Doc->GapVertical   = attrs.valueAsDouble("GapVertical", -1.0);
+		leftScratch = attrs.valueAsDouble("ScratchLeft", 100.0);
+	m_Doc->scratch()->set(attrs.valueAsDouble("ScratchTop", 20.0), leftScratch,
+						  attrs.valueAsDouble("ScratchBottom", 20.0),attrs.valueAsDouble("ScratchRight", 100.0));
+	m_Doc->setPageGapHorizontal(attrs.valueAsDouble("GapHorizontal", -1.0));
+	m_Doc->setPageGapVertical(attrs.valueAsDouble("GapVertical", -1.0));
 	
 	if (attrs.hasAttribute("PAGEC"))
-		m_Doc->papColor = QColor(attrs.valueAsString("PAGEC"));
+		m_Doc->setPaperColor(QColor(attrs.valueAsString("PAGEC")));
 	
 	m_Doc->marginColored = attrs.valueAsBool("RANDF", false);
 
@@ -948,7 +950,7 @@
 	struct PageSet pageS;
 	ScXmlStreamAttributes attrs;
 
-	doc->pageSets.clear();
+	doc->clearPageSets();
 	while(!reader.atEnd() && !reader.hasError())
 	{
 		reader.readNext();
@@ -971,11 +973,12 @@
 		}
 		if(reader.isEndElement() && tagName == "Set")
 		{
-			doc->pageSets.append(pageS);
-			if ((doc->pageSets.count()-1 == doc->currentPageLayout) && ((doc->GapHorizontal < 0) && (doc->GapVertical < 0)))
+			//->Prefs doc->pageSets.append(pageS);
+			doc->appendToPageSets(pageS);
+			if ((doc->pageSets().count()-1 == doc->currentPageLayout) && ((doc->pageGapHorizontal() < 0) && (doc->pageGapVertical() < 0)))
 			{
-				doc->GapHorizontal = attrs.valueAsDouble("GapHorizontal", 0.0);
-				doc->GapVertical   = attrs.valueAsDouble("GapBelow", 0.0);
+				doc->setPageGapHorizontal(attrs.valueAsDouble("GapHorizontal", 0.0));
+				doc->setPageGapVertical(attrs.valueAsDouble("GapBelow", 0.0));
 			}
 		}
 		if (reader.isStartElement() && tagName == "PageNames")
Index: scribus/plugins/svgexplugin/svgexplugin.cpp
===================================================================
--- scribus/plugins/svgexplugin/svgexplugin.cpp	(revision 14923)
+++ scribus/plugins/svgexplugin/svgexplugin.cpp	(revision 14924)
@@ -238,7 +238,7 @@
 		backG.setAttribute("y", "0");
 		backG.setAttribute("width", FToStr(pageWidth));
 		backG.setAttribute("height", FToStr(pageHeight));
-		backG.setAttribute("style", "fill:"+m_Doc->papColor.name()+";" + "stroke:none;");
+		backG.setAttribute("style", "fill:"+m_Doc->paperColor().name()+";" + "stroke:none;");
 		docElement.appendChild(backG);
 	}
 	ScLayer ll;
Index: scribus/canvasmode_normal.cpp
===================================================================
--- scribus/canvasmode_normal.cpp	(revision 14923)
+++ scribus/canvasmode_normal.cpp	(revision 14924)
@@ -869,8 +869,8 @@
 			{
 				double gx, gy, gh, gw;
 				m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
-				FPoint maxSize(gx+gw+m_doc->scratch.Right, gy+gh+m_doc->scratch.Bottom);
-				FPoint minSize(gx-m_doc->scratch.Left, gy-m_doc->scratch.Top);
+				FPoint maxSize(gx+gw+m_doc->scratch()->Right, gy+gh+m_doc->scratch()->Bottom);
+				FPoint minSize(gx-m_doc->scratch()->Left, gy-m_doc->scratch()->Top);
 				m_doc->adjustCanvas(minSize, maxSize);
 			}
 			m_doc->setRedrawBounding(currItem);




More information about the scribus-commit mailing list