r17357 by fschmid - Tables: fourth part of making table cell text really editable, allow inserting Lorem Ipsum.

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 4 20:53:23 UTC 2012


Author: fschmid
Date: Sun Mar  4 20:53:23 2012
New Revision: 17357

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17357
Log:
Tables: fourth part of making table cell text really editable, allow inserting Lorem Ipsum.

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/loremipsum.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17357&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Mar  4 20:53:23 2012
@@ -2874,6 +2874,7 @@
 			charPalette->setEnabled(true, currItem);
 			PageItem *i2 = currItem->asTable()->activeCell().textFrame();
 			enableTextActions(&scrActions, true, i2->currentCharStyle().font().scName());
+			scrActions["insertSampleText"]->setEnabled(true);
 		}
 		break;
 	case PageItem::PathText: //Path Text
@@ -6405,11 +6406,13 @@
 		{
 			charPalette->setEnabled(false, 0);
 			enableTextActions(&scrActions, false);
+			scrActions["insertSampleText"]->setEnabled(false);
 			actionManager->restoreActionShortcutsPostEditMode();
 		}
 		else if (mode == modeEditTable && oldMode != modeEditTable)
 		{
 			charPalette->setEnabled(true, currItem);
+			scrActions["insertSampleText"]->setEnabled(true);
 			PageItem *i2 = currItem->asTable()->activeCell().textFrame();
 			enableTextActions(&scrActions, true, i2->currentCharStyle().font().scName());
 			actionManager->saveActionShortcutsPreEditMode();

Modified: trunk/Scribus/scribus/ui/loremipsum.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17357&path=/trunk/Scribus/scribus/ui/loremipsum.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/loremipsum.cpp (original)
+++ trunk/Scribus/scribus/ui/loremipsum.cpp Sun Mar  4 20:53:23 2012
@@ -35,6 +35,7 @@
 
 #include "langmgr.h"
 #include "pageitem.h"
+#include "pageitem_table.h"
 #include "pageitem_textframe.h"
 #include "scribus.h"
 #include "scribusdoc.h"
@@ -276,17 +277,22 @@
 
 	for (int i = 0; i < m_Doc->m_Selection->count(); ++i)
 	{
-		PageItem* currItem=m_Doc->m_Selection->itemAt(i);
+		PageItem* currItem = m_Doc->m_Selection->itemAt(i);
 		if (currItem == NULL)
 			continue;
-		if (!currItem->asTextFrame())
+		PageItem *i2 = currItem;
+		if (m_Doc->appMode == modeEditTable)
+			i2 = currItem->asTable()->activeCell().textFrame();
+		if (!i2->asTextFrame())
 			continue;
-		if (currItem->itemText.length() != 0)
-		{
-			m_Doc->itemSelection_ClearItem();
+		if (i2->itemText.length() != 0)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_Doc->itemSelection_ClearItem(&tempSelection);
 			/* ClearItem() doesn't return true or false so
 			the following test has to be done */
-			if (currItem->itemText.length() != 0)
+			if (i2->itemText.length() != 0)
 				continue;
 		}
 		LoremParser *lp = new LoremParser(name);
@@ -305,7 +311,7 @@
 				writer->setOverridePStyleFont(false);
 				gtFrameStyle* fstyle = writer->getDefaultStyle();
 				gtParagraphStyle* pstyle = new gtParagraphStyle(*fstyle);
-				pstyle->setName(currItem->currentStyle().name());
+				pstyle->setName(i2->currentStyle().name());
 				writer->setParagraphStyle(pstyle);
 				done = true;
 				writer->append(lp->createLorem(paraCount));
@@ -314,20 +320,14 @@
 #endif
 		
 		// K.I.S.S.:
-		currItem->itemText.insertChars(0, lp->createLorem(paraCount, random));
+		i2->itemText.insertChars(0, lp->createLorem(paraCount, random));
 		delete lp;
-
-		//if (ScMW->view->SelItem.at(i)->Doc->docHyphenator->AutoCheck)
-		//	ScMW->view->SelItem.at(i)->Doc->docHyphenator->slotHyphenate(ScMW->view->SelItem.at(i));
 		if (m_Doc->docHyphenator->AutoCheck)
-			m_Doc->docHyphenator->slotHyphenate(currItem);
-		currItem->invalidateLayout();
-	}
-// 	if (done)
-// 	{
- 		m_Doc->regionsChanged()->update(QRectF());
-		m_Doc->changed();
-// 	}
+			m_Doc->docHyphenator->slotHyphenate(i2);
+		i2->invalidateLayout();
+	}
+	m_Doc->regionsChanged()->update(QRectF());
+	m_Doc->changed();
 }
 
 QString LoremManager::loremIpsum()




More information about the scribus-commit mailing list