[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kspread (silent)
From:       Stefan Nikolaus <nikolaus4 () googlemail ! com>
Date:       2008-06-01 16:13:29
Message-ID: 1212336809.602194.18663.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 815375 by nikolaus:

Printing	Move the print region into PrintSettings.
SVN_SILENT


 M  +6 -12     PrintManager.cpp  
 M  +27 -0     PrintSettings.cpp  
 M  +6 -0      PrintSettings.h  


--- trunk/koffice/kspread/PrintManager.cpp #815374:815375
@@ -39,7 +39,6 @@
     Sheet* sheet;
     SheetView* sheetView;
     QMap<int, QRect> pages; // page number to cell range
-    Region printRegion;
     PrintSettings settings;
     KoZoomHandler* zoomHandler;
 
@@ -58,15 +57,13 @@
 
     if (settings.pageOrder() == PrintSettings::LeftToRight)
     {
-//         kDebug() << "processing printRanges" << printRegion;
+//         kDebug() << "processing printRanges" << settings.printRegion();
         // iterate over the print ranges
-        Region::ConstIterator end = printRegion.constEnd();
-        for (Region::ConstIterator it = printRegion.constBegin(); it != end; ++it)
+        Region::ConstIterator end = settings.printRegion().constEnd();
+        for (Region::ConstIterator it = settings.printRegion().constBegin(); it != end; ++it)
         {
             if (!(*it)->isValid())
                 continue;
-            if ((*it)->sheet() != sheet)
-                continue;
 
             // limit the print range to the used area
             const QRect printRange = (*it)->rect() & sheet->usedArea();
@@ -120,15 +117,13 @@
     }
     else // if (settings.pageOrder() == PrintSettings::TopToBottom)
     {
-//         kDebug() << "processing printRanges" << printRegion;
+//         kDebug() << "processing printRanges" << settings.printRegion();
         // iterate over the print ranges
-        Region::ConstIterator end = printRegion.constEnd();
-        for (Region::ConstIterator it = printRegion.constBegin(); it != end; ++it)
+        Region::ConstIterator end = settings.printRegion().constEnd();
+        for (Region::ConstIterator it = settings.printRegion().constBegin(); it != end; ++it)
         {
             if (!(*it)->isValid())
                 continue;
-            if ((*it)->sheet() != sheet)
-                continue;
 
             // limit the print range to the used area
             const QRect printRange = (*it)->rect() & sheet->usedArea();
@@ -225,7 +220,6 @@
     d->sheet = sheet;
     d->sheetView = new SheetView(sheet);
     d->settings = *sheet->printSettings();
-    d->printRegion = Region(1, 1, KS_colMax, KS_rowMax, sheet);
     d->zoomHandler = new KoZoomHandler();
 }
 
--- trunk/koffice/kspread/PrintSettings.cpp #815374:815375
@@ -23,6 +23,10 @@
 // Local
 #include "PrintSettings.h"
 
+// KSpread
+#include "Global.h"
+#include "Region.h"
+
 // KOffice
 #include <KoPageLayout.h>
 #include <KoUnit.h>
@@ -40,6 +44,7 @@
     bool printCommentIndicator  : 1;
     bool printFormulaIndicator  : 1;
     PageOrder pageOrder;
+    Region printRegion;
 
 public:
     void calculatePageDimensions();
@@ -65,6 +70,7 @@
     d->printCommentIndicator = false;
     d->printFormulaIndicator = false;
     d->pageOrder = LeftToRight;
+    d->printRegion = Region(1, 1, KS_colMax, KS_rowMax);
 }
 
 PrintSettings::PrintSettings(const PrintSettings& other)
@@ -78,6 +84,7 @@
     d->printCommentIndicator = other.d->printCommentIndicator;
     d->printFormulaIndicator = other.d->printFormulaIndicator;
     d->pageOrder = other.d->pageOrder;
+    d->printRegion = other.d->printRegion;
 }
 
 PrintSettings::~PrintSettings()
@@ -187,6 +194,26 @@
     d->printFormulaIndicator = printFormulaIndicator;
 }
 
+const KSpread::Region& PrintSettings::printRegion() const
+{
+    return d->printRegion;
+}
+
+void PrintSettings::setPrintRegion(const Region& region)
+{
+    d->printRegion = region;
+}
+
+void PrintSettings::addPrintRange(const QRect& range)
+{
+    d->printRegion.add(range);
+}
+
+void PrintSettings::removePrintRange(const QRect& range)
+{
+    d->printRegion.sub(range, 0);
+}
+
 void PrintSettings::operator=(const PrintSettings& other)
 {
     d->pageLayout = other.d->pageLayout;
--- trunk/koffice/kspread/PrintSettings.h #815374:815375
@@ -28,6 +28,7 @@
 
 namespace KSpread
 {
+class Region;
 
 class KSPREAD_EXPORT PrintSettings
 {
@@ -140,6 +141,11 @@
      */
     void setPrintFormulaIndicator(bool printFormulaIndicator);
 
+    const Region& printRegion() const;
+    void setPrintRegion(const Region& region);
+    void addPrintRange(const QRect& range);
+    void removePrintRange(const QRect& range);
+
     /**
      * Assignment operator.
      */
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic