r17353 by fschmid - Tables: first part of making table cell text really editable

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 4 17:42:47 UTC 2012


Author: fschmid
Date: Sun Mar  4 17:42:46 2012
New Revision: 17353

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17353
Log:
Tables: first part of making table cell text really editable

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/ui/propertiespalette.cpp
    trunk/Scribus/scribus/ui/propertiespalette.h
    trunk/Scribus/scribus/ui/propertiespalette_text.cpp
    trunk/Scribus/scribus/ui/propertywidget_advanced.cpp
    trunk/Scribus/scribus/ui/propertywidget_dropcap.cpp
    trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17353&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Mar  4 17:42:46 2012
@@ -6893,7 +6893,15 @@
 			}
 		}
 	}
-	doc->itemSelection_SetFont(nf2);
+	PageItem *i2 = doc->m_Selection->itemAt(0);
+	if (doc->appMode == modeEditTable)
+		i2 = doc->m_Selection->itemAt(0)->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		doc->itemSelection_SetFont(nf2, &tempSelection);
+	}
 //	doc->currentStyle.charStyle().setFont((*doc->AllFonts)[nf2]);
 	view->DrawNew();
 // 	slotDocCh();

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17353&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Mar  4 17:42:46 2012
@@ -7831,7 +7831,7 @@
 			if (currItem->itemText.length() != 0)
 			{
 #ifndef NLS_PROTO
-				if (appMode == modeEdit)
+				if ((appMode == modeEdit) || (appMode == modeEditTable))
 				{
 					for (int a = 0; a < currItem->itemText.length(); ++a)
 					{
@@ -7901,7 +7901,7 @@
 
 void ScribusDoc::itemSelection_SetFontSize(int size, Selection* customSelection)
 {
-	if (true || appMode == modeEdit) 
+	if (true || ((appMode == modeEdit) || (appMode == modeEditTable)))
 	{
 		CharStyle newStyle;
 		newStyle.setFontSize(size);
@@ -7943,11 +7943,11 @@
 //		int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame();
 //		if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
 		int currItemTextCount = currItem->itemText.length();
-		if ((currItemTextCount > 0) && (appMode == modeEdit))
+		if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
 		{
 			int start = currItem->itemText.startOfItem(currItem->firstInFrame());
 			int stop = currItem->itemText.endOfItem(currItem->lastInFrame());
-			if (appMode == modeEdit)
+			if ((appMode == modeEdit) || (appMode == modeEditTable))
 			{
 				start = currItem->itemText.startOfSelection();
 				stop = currItem->itemText.endOfSelection();
@@ -7997,11 +7997,11 @@
 //		int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame();
 //		if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
 		int currItemTextCount = currItem->itemText.length();
-		if ((currItemTextCount > 0) && (appMode == modeEdit))
+		if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
 		{
 			int start = currItem->itemText.startOfItem(currItem->firstInFrame());
 			int stop = currItem->itemText.endOfItem(currItem->lastInFrame());
-			if (appMode == modeEdit)
+			if ((appMode == modeEdit) || (appMode == modeEditTable))
 			{
 				start = currItem->itemText.startOfSelection();
 				stop = currItem->itemText.endOfSelection();
@@ -8055,7 +8055,7 @@
 	{
 		PageItem *currItem = itemSelection->itemAt(aa);
 		int currItemTextCount = currItem->itemText.length();
-		if ((currItemTextCount == 0) || (appMode != modeEdit))
+		if ((currItemTextCount == 0) || ((appMode == modeEdit) || (appMode == modeEditTable)))
 		{
 			ParagraphStyle dstyle(currItem->itemText.defaultStyle());
 			dstyle.applyStyle(newStyle);
@@ -8065,7 +8065,7 @@
 		{
 			int start = currItem->asPathText() ? currItem->itemText.startOfItem(currItem->firstInFrame()) : 0;
 			int stop  = currItem->asPathText() ? currItem->itemText.endOfItem(currItem->lastInFrame()) :  currItemTextCount;
-			if (appMode == modeEdit)
+			if ((appMode == modeEdit) || (appMode == modeEditTable))
 			{
 				start = currItem->itemText.startOfSelection();
 				stop = currItem->itemText.endOfSelection();
@@ -8112,11 +8112,11 @@
 //		int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame();
 //		if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
 		int currItemTextCount = currItem->itemText.length();
-		if ((currItemTextCount > 0) && (appMode == modeEdit))
+		if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
 		{
 			int start = currItem->itemText.startOfItem(currItem->firstInFrame());
 			int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
-			if (appMode == modeEdit)
+			if ((appMode == modeEdit) || (appMode == modeEditTable))
 			{
 				if (currItem->itemText.lengthOfSelection() > 0)
 				{
@@ -8172,11 +8172,11 @@
 //		int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame();
 //		if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
 		int currItemTextCount = currItem->itemText.length();
-		if ((currItemTextCount > 0) && (appMode == modeEdit))
+		if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
 		{
 			int start = currItem->itemText.startOfItem(currItem->firstInFrame());
 			int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
-			if (appMode == modeEdit)
+			if ((appMode == modeEdit) || (appMode == modeEditTable))
 			{
 				if (currItem->itemText.lengthOfSelection() > 0)
 				{
@@ -8231,11 +8231,11 @@
 //		int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame();
 //		if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
 		int currItemTextCount = currItem->itemText.length();
-		if ((currItemTextCount > 0) && (appMode == modeEdit))
+		if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
 		{
 			int start = currItem->itemText.startOfItem(currItem->firstInFrame());
 			int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
-			if (appMode == modeEdit)
+			if ((appMode == modeEdit) || (appMode == modeEditTable))
 			{
 				if (currItem->itemText.lengthOfSelection() > 0)
 				{
@@ -10118,9 +10118,10 @@
 	changed();
 }
 
-void ScribusDoc::itemSelection_SetItemTextReversed(bool reversed)
-{
-	uint selectedItemCount = m_Selection->count();
+void ScribusDoc::itemSelection_SetItemTextReversed(bool reversed, Selection *customSelection)
+{
+	Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
+	uint selectedItemCount = itemSelection->count();
 	if (selectedItemCount != 0)
 	{
 		UndoTransaction *activeTransaction = NULL;
@@ -10128,7 +10129,7 @@
 			activeTransaction = new UndoTransaction(undoManager->beginTransaction());
 		for (uint i = 0; i < selectedItemCount; ++i)
 		{
-			PageItem *currItem = m_Selection->itemAt(i);
+			PageItem *currItem = itemSelection->itemAt(i);
 			currItem->setImageFlippedH(reversed);
 			currItem->setReversed(reversed);
 		}

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17353&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sun Mar  4 17:42:46 2012
@@ -1315,7 +1315,7 @@
 	void itemSelection_ClearItem(Selection* customSelection=0);
 	//! Delete the items in the current selection. When force is true, we do not warn the user and make SE happy too. Force is used from @sa Page::restorePageItemCreation
 	void itemSelection_DeleteItem(Selection* customSelection=0, bool forceDeletion=false);
-	void itemSelection_SetItemTextReversed(bool reversed);
+	void itemSelection_SetItemTextReversed(bool reversed, Selection* customSelection=0);
 	void itemSelection_SetItemFillTransparency(double t);
 	void itemSelection_SetItemLineTransparency(double t);
 	void itemSelection_SetItemFillBlend(int t);

Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17353&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Sun Mar  4 17:42:46 2012
@@ -36,6 +36,7 @@
 #include "colorlistbox.h"
 #include "sccolorengine.h"
 #include "cpalette.h"
+#include "pageitem_table.h"
 #include "pageitem_textframe.h"
 #include "propertiespalette_group.h"
 #include "propertiespalette_image.h"
@@ -246,6 +247,7 @@
 	//connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
 	//connect(this->Cpal, SIGNAL(strokeGradientChanged()), m_ScMW, SLOT(updtGradStroke()));
 	connect(this->Tpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradMask()));
+	connect(m_ScMW, SIGNAL(AppModeChanged(int,int)), this, SLOT(AppModeChanged()));
 }
 
 void PropertiesPalette::SelTab(int t)
@@ -394,6 +396,24 @@
 	return currentItem;
 }
 
+void PropertiesPalette::AppModeChanged()
+{
+	if (!m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	if ((m_haveDoc) && (m_haveItem))
+	{
+		if (m_item->isTable())
+		{
+			TabStack->setItemEnabled(idTextItem, m_doc->appMode == modeEditTable);
+			if (m_doc->appMode == modeEditTable)
+				connect(m_item->asTable(), SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+			else
+				disconnect(m_item->asTable(), SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+		}
+		textPal->handleSelectionChanged();
+	}
+}
+
 void PropertiesPalette::setCurrentItem(PageItem *i)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -424,15 +444,6 @@
 
 	tablePal->setItem(m_item);
 
-	/*xyzPal->handleSelectionChanged();
-	shapePal->handleSelectionChanged();
-	groupPal->handleSelectionChanged();
-	imagePal->handleSelectionChanged();
-	linePal->handleSelectionChanged();
-	textPal->handleSelectionChanged();*/
-
-	/*Cpal->setCurrentItem(m_item);
-	Cpal->updateFromItem();*/
 	Tpal->setCurrentItem(m_item);
 	Tpal->updateFromItem();
 
@@ -505,15 +516,6 @@
 		return;
 	int currentTab = TabStack->currentIndex();
 	disconnect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
-
-//	qDebug() << "PropertiesPalette::handleSelectionChanged()";
-
-	/*xyzPal->handleSelectionChanged();
-	shapePal->handleSelectionChanged();
-	groupPal->handleSelectionChanged();
-	imagePal->handleSelectionChanged();
-	linePal->handleSelectionChanged();
-	textPal->handleSelectionChanged();*/
 
 	PageItem* currItem = currentItemFromSelection();
 	if (m_doc->m_Selection->count() > 1)
@@ -623,7 +625,7 @@
 		case PageItem::Table:
 			TabStack->setItemEnabled(idTableItem, true);
 			TabStack->setItemEnabled(idShapeItem, true);
-			TabStack->setItemEnabled(idTextItem, false);
+			TabStack->setItemEnabled(idTextItem, m_doc->appMode == modeEditTable);
 			TabStack->setItemEnabled(idImageItem, false);
 			TabStack->setItemEnabled(idLineItem, false);
 			TabStack->setItemEnabled(idGroupItem, false);

Modified: trunk/Scribus/scribus/ui/propertiespalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17353&path=/trunk/Scribus/scribus/ui/propertiespalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.h (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.h Sun Mar  4 17:42:46 2012
@@ -90,6 +90,7 @@
 	void setMainWindow(ScribusMainWindow *mw);
 	
 	void setDoc(ScribusDoc *d);
+	void AppModeChanged();
 	void setCurrentItem(PageItem *i);
 	void unsetDoc();
 	void unsetItem();

Modified: trunk/Scribus/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17353&path=/trunk/Scribus/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_text.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_text.cpp Sun Mar  4 17:42:46 2012
@@ -15,6 +15,7 @@
 #include "commonstrings.h"
 #include "colorlistbox.h"
 #include "pageitem.h"
+#include "pageitem_table.h"
 #include "pageitem_textframe.h"
 #include "propertiespalette_utils.h"
 #include "propertywidget_advanced.h"
@@ -266,6 +267,9 @@
 		case PageItem::PathText:
 			setEnabled(true);
 			break;
+		case PageItem::Table:
+			setEnabled(m_doc->appMode == modeEditTable);
+			break;
 		default:
 			setEnabled(false);
 			break;
@@ -320,9 +324,16 @@
 	m_haveItem = false;
 	m_item = i;
 
-	QString tm;
-	PageItem_TextFrame *i2=m_item->asTextFrame();
-	if (i2!=0)
+	if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable())
+	{
+		fonts->RebuildList(m_doc, m_item->isAnnotation());
+	}
+	PageItem_TextFrame *i2;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	else
+		i2 = m_item->asTextFrame();
+	if (i2 != 0)
 	{
 		disconnect(distanceWidgets->columnGap, SIGNAL(valueChanged(double)), this, SLOT(handleColumnGap()));
 		disconnect(distanceWidgets->columns  , SIGNAL(valueChanged(int)), this, SLOT(handleColumns()));
@@ -357,18 +368,12 @@
 		// I put it here because it’s visually grouped with these elements
 		// but it’s a PageItem prop. and as such should be set without considering
 		// the frame type.
-		displayFirstLinePolicy(m_item->firstLineOffset());
+		displayFirstLinePolicy(i2->firstLineOffset());
 		
 		connect(distanceWidgets->columnGap, SIGNAL(valueChanged(double)), this, SLOT(handleColumnGap()));
 		connect(distanceWidgets->columns, SIGNAL(valueChanged(int))   , this, SLOT(handleColumns()));
 	}
 
-	if (m_item->asTextFrame() || m_item->asPathText())
-	{
-		fonts->RebuildList(m_doc, m_item->isAnnotation());
-	}
-
-	displayTextDistances(i->textToFrameDistLeft(),i->textToFrameDistTop(),i->textToFrameDistBottom(),i->textToFrameDistRight());
 
 	if ((m_item->isGroup()) && (!m_item->isSingleSel))
 	{
@@ -387,7 +392,7 @@
 		pathTextWidgets->distFromCurve->setValue(m_item->BaseOffs * -1);
 		pathTextWidgets->startOffset->setValue(m_item->textToFrameDistLeft());
 	}
-	else if (m_item->asTextFrame())
+	else if (m_item->asTextFrame() || m_item->asTable())
 	{
 		flopItem->setHidden(false);
 		distanceItem->setHidden(false);
@@ -405,12 +410,16 @@
 	}
 
 	m_haveItem = true;
-
-	if (m_item->asTextFrame() || m_item->asPathText())
+	if (i2 != 0)
+		displayTextDistances(i2->textToFrameDistLeft(),i2->textToFrameDistTop(),i2->textToFrameDistBottom(),i2->textToFrameDistRight());
+
+	if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable())
 	{
 		ParagraphStyle parStyle =  m_item->itemText.defaultStyle();
 		if (m_doc->appMode == modeEdit)
 			m_item->currentTextProps(parStyle);
+		else if (m_doc->appMode == modeEditTable)
+			m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle);
 		updateStyle(parStyle);
 	}
 	if (m_item->asOSGFrame())
@@ -451,8 +460,12 @@
 	distanceWidgets->columnGap->setValue(g*m_unitRatio);
 	if (tmp)
 	{
-		PageItem_TextFrame *i2=m_item->asTextFrame();
-		if (i2!=0)
+		PageItem_TextFrame *i2;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		else
+			i2 = m_item->asTextFrame();
+		if (i2 != 0)
 		{
 			distanceWidgets->columns->setMaximum(qMax(qRound(i2->width() / qMax(i2->ColGap, 10.0)), 1));
 			if (distanceWidgets->columnGapLabel->currentIndex() == 0)
@@ -486,8 +499,17 @@
 {
 	if ((m_haveDoc) && (m_haveItem))
 	{
-		m_doc->itemSelection_SetLineSpacingMode(id);
-		updateStyle(m_doc->appMode == modeEdit? m_item->currentStyle() : m_item->itemText.defaultStyle());
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_doc->itemSelection_SetLineSpacingMode(id, &tempSelection);
+			updateStyle(((m_doc->appMode == modeEdit) || (m_doc->appMode == modeEditTable)) ? i2->currentStyle() : i2->itemText.defaultStyle());
+			m_doc->regionsChanged()->update(QRect());
+		}
 	}
 }
 
@@ -498,11 +520,17 @@
 	bool tmp = m_haveItem;
 	m_haveItem = false;
 	lineSpacing->setValue(r);
-	const ParagraphStyle& curStyle(tmp && m_doc->appMode == modeEdit? m_item->currentStyle() : m_item->itemText.defaultStyle());
-	if (tmp)
-	{
-		setupLineSpacingSpinbox(curStyle.lineSpacingMode(), r);
-		lineSpacingModeCombo->setCurrentIndex(curStyle.lineSpacingMode());
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		const ParagraphStyle& curStyle(tmp && m_doc->appMode == modeEdit? i2->currentStyle() : i2->itemText.defaultStyle());
+		if (tmp)
+		{
+			setupLineSpacingSpinbox(curStyle.lineSpacingMode(), r);
+			lineSpacingModeCombo->setCurrentIndex(curStyle.lineSpacingMode());
+		}
 	}
 	m_haveItem = tmp;
 }
@@ -665,14 +693,30 @@
 	else if (optMargins->optMarginRadioRight->isChecked())
 		omt = ParagraphStyle::OM_RightHangingPunct;
 
-	m_doc->itemSelection_SetOpticalMargins(omt);
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetOpticalMargins(omt, &tempSelection);
+	}
 }
 
 void PropertiesPalette_Text::resetOpticalMargins()
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_resetOpticalMargins();
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_resetOpticalMargins(&tempSelection);
+	}
 }
 
 void PropertiesPalette_Text::displayOpticalMargins(const ParagraphStyle & pStyle)
@@ -694,14 +738,26 @@
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetLineSpacing(lineSpacing->value());
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetLineSpacing(lineSpacing->value(), &tempSelection);
+	}
 }
 
 void PropertiesPalette_Text::handleGapSwitch()
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	displayColumns(m_item->Cols, m_item->ColGap);
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+		displayColumns(i2->Cols, i2->ColGap);
 	distanceWidgets->columnGap->setToolTip("");
 	if (distanceWidgets->columnGapLabel->currentIndex() == 0)
 		distanceWidgets->columnGap->setToolTip( tr( "Distance between columns" ) );
@@ -713,53 +769,91 @@
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_item->Cols = distanceWidgets->columns->value();
-	displayColumns(m_item->Cols, m_item->ColGap);
-	if (distanceWidgets->columns->value() == 1)
-	{
-		distanceWidgets->columnGap->setEnabled(false);
-		distanceWidgets->columnGapLabel->setEnabled(false);
-	}
-	else
-	{
-		distanceWidgets->columnGap->setEnabled(true);
-		distanceWidgets->columnGapLabel->setEnabled(true);
-	}
-	m_item->update();
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		i2->Cols = distanceWidgets->columns->value();
+		displayColumns(i2->Cols, i2->ColGap);
+		if (distanceWidgets->columns->value() == 1)
+		{
+			distanceWidgets->columnGap->setEnabled(false);
+			distanceWidgets->columnGapLabel->setEnabled(false);
+		}
+		else
+		{
+			distanceWidgets->columnGap->setEnabled(true);
+			distanceWidgets->columnGapLabel->setEnabled(true);
+		}
+		i2->update();
+		if (m_doc->appMode == modeEditTable)
+			m_item->asTable()->update();
+		else
+			m_item->update();
+		m_doc->regionsChanged()->update(QRect());
+	}
 }
 
 void PropertiesPalette_Text::handleColumnGap()
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	if (distanceWidgets->columnGapLabel->currentIndex() == 0)
-		m_item->ColGap = distanceWidgets->columnGap->value() / m_unitRatio;
-	else
-	{
-		double lineCorr;
-		if ((m_item->lineColor() != CommonStrings::None) || (!m_item->strokePattern().isEmpty()))
-			lineCorr = m_item->lineWidth();
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		if (distanceWidgets->columnGapLabel->currentIndex() == 0)
+			i2->ColGap = distanceWidgets->columnGap->value() / m_unitRatio;
 		else
-			lineCorr = 0;
-		double newWidth = distanceWidgets->columnGap->value() / m_unitRatio;
-		double newGap = qMax(((m_item->width() - m_item->textToFrameDistLeft() - m_item->textToFrameDistRight() - lineCorr) - (newWidth * m_item->Cols)) / (m_item->Cols - 1), 0.0);
-		m_item->ColGap = newGap;
-	}
-	m_item->update();
+		{
+			double lineCorr;
+			if ((i2->lineColor() != CommonStrings::None) || (!i2->strokePattern().isEmpty()))
+				lineCorr = i2->lineWidth();
+			else
+				lineCorr = 0;
+			double newWidth = distanceWidgets->columnGap->value() / m_unitRatio;
+			double newGap = qMax(((i2->width() - i2->textToFrameDistLeft() - i2->textToFrameDistRight() - lineCorr) - (newWidth * i2->Cols)) / (i2->Cols - 1), 0.0);
+			i2->ColGap = newGap;
+		}
+		i2->update();
+		if (m_doc->appMode == modeEditTable)
+			m_item->asTable()->update();
+		else
+			m_item->update();
+		m_doc->regionsChanged()->update(QRect());
+	}
 }
 
 void PropertiesPalette_Text::handleFontSize()
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetFontSize(qRound(fontSize->value()*10.0));
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetFontSize(qRound(fontSize->value()*10.0), &tempSelection);
+	}
 }
 
 void PropertiesPalette_Text::handleAlignement(int a)
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetAlignment(a);
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetAlignment(a, &tempSelection);
+	}
 }
 
 void PropertiesPalette_Text::handleTextDistances()
@@ -768,13 +862,24 @@
 		return;
 	if ((m_haveDoc) && (m_haveItem))
 	{
-		double left   = distanceWidgets->leftDistance->value() / m_unitRatio;
-		double right  = distanceWidgets->rightDistance->value() / m_unitRatio;
-		double top    = distanceWidgets->topDistance->value() / m_unitRatio;
-		double bottom = distanceWidgets->bottomDistance->value() / m_unitRatio;
-		m_item->setTextToFrameDist(left, right, top, bottom);
-		displayColumns(m_item->Cols, m_item->ColGap);
-		m_item->update();
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			double left   = distanceWidgets->leftDistance->value() / m_unitRatio;
+			double right  = distanceWidgets->rightDistance->value() / m_unitRatio;
+			double top    = distanceWidgets->topDistance->value() / m_unitRatio;
+			double bottom = distanceWidgets->bottomDistance->value() / m_unitRatio;
+			i2->setTextToFrameDist(left, right, top, bottom);
+			displayColumns(i2->Cols, i2->ColGap);
+			i2->update();
+			if (m_doc->appMode == modeEditTable)
+				m_item->asTable()->update();
+			else
+				m_item->update();
+			m_doc->regionsChanged()->update(QRect());
+		}
 	}
 }
 
@@ -791,7 +896,15 @@
 		return;
 	if (m_haveDoc)
 	{
-		m_doc->itemSelection_EraseCharStyle();
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_doc->itemSelection_EraseCharStyle(&tempSelection);
+		}
 	}
 }
 
@@ -802,9 +915,17 @@
 		return;
 	if (m_haveDoc)
 	{
-		m_doc->itemSelection_EraseParagraphStyle();
-		CharStyle emptyCStyle;
-		m_doc->itemSelection_SetCharStyle(emptyCStyle);
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_doc->itemSelection_EraseParagraphStyle(&tempSelection);
+			CharStyle emptyCStyle;
+			m_doc->itemSelection_SetCharStyle(emptyCStyle, &tempSelection);
+		}
 	}
 }
 
@@ -978,11 +1099,22 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning() || !m_haveDoc || !m_haveItem)
 		return;
-	if( radioFlop == PropertyWidget_Flop::RealHeightID)
-		m_item->setFirstLineOffset(FLOPRealGlyphHeight);
-	else if( radioFlop == PropertyWidget_Flop::FontAscentID)
-		m_item->setFirstLineOffset(FLOPFontAscent);
-	else if( radioFlop == PropertyWidget_Flop::LineSpacingID)
-		m_item->setFirstLineOffset(FLOPLineSpacing);
-	m_item->update();
-}
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		if( radioFlop == PropertyWidget_Flop::RealHeightID)
+			i2->setFirstLineOffset(FLOPRealGlyphHeight);
+		else if( radioFlop == PropertyWidget_Flop::FontAscentID)
+			i2->setFirstLineOffset(FLOPFontAscent);
+		else if( radioFlop == PropertyWidget_Flop::LineSpacingID)
+			i2->setFirstLineOffset(FLOPLineSpacing);
+		i2->update();
+		if (m_doc->appMode == modeEditTable)
+			m_item->asTable()->update();
+		else
+			m_item->update();
+		m_doc->regionsChanged()->update(QRect());
+	}
+}

Modified: trunk/Scribus/scribus/ui/propertywidget_advanced.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17353&path=/trunk/Scribus/scribus/ui/propertywidget_advanced.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_advanced.cpp (original)
+++ trunk/Scribus/scribus/ui/propertywidget_advanced.cpp Sun Mar  4 17:42:46 2012
@@ -7,6 +7,7 @@
 
 #include "propertywidget_advanced.h"
 
+#include "pageitem_table.h"
 #include "scribus.h"
 #include "selection.h"
 #include "units.h"
@@ -31,7 +32,7 @@
 	scaleH->setValues(10, 400, 2, 100 );
 	scaleHLabel->setPixmap(loadIcon("textscaleh.png"));
 
-	scaleH->setValues(10, 400, 2, 100 );
+	scaleV->setValues(10, 400, 2, 100 );
 	scaleVLabel->setPixmap(loadIcon("textscalev.png"));
 
 	minWordTrackingLabel->setBuddy(minWordTrackingSpinBox);
@@ -102,11 +103,13 @@
 
 	if (m_item)
 	{
-		if (m_item->asTextFrame() || m_item->asPathText())
+		if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable())
 		{
 			ParagraphStyle parStyle =  m_item->itemText.defaultStyle();
 			if (m_doc->appMode == modeEdit)
 				m_item->currentTextProps(parStyle);
+			else if (m_doc->appMode == modeEditTable)
+				m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle);
 			updateStyle(parStyle);
 		}
 		connectSignals();
@@ -142,7 +145,7 @@
 	bool enabled = false;
 	if (m_item && m_doc)
 	{
-		if (m_item->asPathText() || m_item->asTextFrame())
+		if (m_item->asPathText() || m_item->asTextFrame() || m_item->asTable())
 			enabled = true;
 		if ((m_item->isGroup()) && (!m_item->isSingleSel))
 			enabled = false;
@@ -197,64 +200,128 @@
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetBaselineOffset(qRound(textBase->value() * 10));
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetBaselineOffset(qRound(textBase->value() * 10), &tempSelection);
+	}
 }
 
 void PropertyWidget_Advanced::handleMinWordTracking()
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	ParagraphStyle newStyle;
-	newStyle.setMinWordTracking(minWordTrackingSpinBox->value() / 100.0);
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		ParagraphStyle newStyle;
+		newStyle.setMinWordTracking(minWordTrackingSpinBox->value() / 100.0);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
 }
 
 void PropertyWidget_Advanced::handleNormWordTracking()
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	ParagraphStyle newStyle;
-	newStyle.charStyle().setWordTracking(normWordTrackingSpinBox->value() / 100.0);
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		ParagraphStyle newStyle;
+		newStyle.charStyle().setWordTracking(normWordTrackingSpinBox->value() / 100.0);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
 }
 
 void PropertyWidget_Advanced::handleMinGlyphExtension()
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	ParagraphStyle newStyle;
-	newStyle.setMinGlyphExtension(minGlyphExtSpinBox->value() / 100.0);
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		ParagraphStyle newStyle;
+		newStyle.setMinGlyphExtension(minGlyphExtSpinBox->value() / 100.0);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
 }
 
 void PropertyWidget_Advanced::handleMaxGlyphExtension()
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	ParagraphStyle newStyle;
-	newStyle.setMaxGlyphExtension(maxGlyphExtSpinBox->value() / 100.0);
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		ParagraphStyle newStyle;
+		newStyle.setMaxGlyphExtension(maxGlyphExtSpinBox->value() / 100.0);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
 }
 
 void PropertyWidget_Advanced::handleTextScaleH()
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetScaleH(qRound(scaleH->value() * 10));
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetScaleH(qRound(scaleH->value() * 10), &tempSelection);
+	}
 }
 
 void PropertyWidget_Advanced::handleTextScaleV()
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetScaleV(qRound(scaleV->value() * 10));
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetScaleV(qRound(scaleV->value() * 10), &tempSelection);
+	}
 }
 
 void PropertyWidget_Advanced::handleTracking()
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetTracking(qRound(tracking->value() * 10.0));
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetTracking(qRound(tracking->value() * 10.0), &tempSelection);
+	}
 }
 
 void PropertyWidget_Advanced::updateCharStyle(const CharStyle& charStyle)
@@ -326,4 +393,4 @@
 	normWordTrackingSpinBox->setToolTip( tr("Normal width of spaces between words"));
 	minGlyphExtSpinBox->setToolTip( tr("Minimal shrinkage of glyphs for justification"));
 	maxGlyphExtSpinBox->setToolTip( tr("Maximal extension of glyphs for justification"));
-}
+}

Modified: trunk/Scribus/scribus/ui/propertywidget_dropcap.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17353&path=/trunk/Scribus/scribus/ui/propertywidget_dropcap.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_dropcap.cpp (original)
+++ trunk/Scribus/scribus/ui/propertywidget_dropcap.cpp Sun Mar  4 17:42:46 2012
@@ -5,8 +5,10 @@
 for which a new license (GPL+exception) is in place.
 */
 
+#include "pageitem_table.h"
 #include "propertywidget_dropcap.h"
 #include "scribus.h"
+#include "selection.h"
 #include "units.h"
 #include "util.h"
 
@@ -99,7 +101,15 @@
 	if (!m_doc) return;
 	ParagraphStyle newStyle;
 	newStyle.setHasDropCap(dropCapBox->isChecked());
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	PageItem *i2 = m_doc->m_Selection->itemAt(0);
+	if (m_doc->appMode == modeEditTable)
+		i2 = i2->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
 	enableDropCap(dropCapBox->isChecked());
 }
 
@@ -108,7 +118,16 @@
 	if (!m_doc) return;
 	ParagraphStyle newStyle;
 	newStyle.setDropCapLines(dropCapLines->value());
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	newStyle.setHasDropCap(dropCapBox->isChecked());
+	PageItem *i2 = m_doc->m_Selection->itemAt(0);
+	if (m_doc->appMode == modeEditTable)
+		i2 = i2->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
 }
 
 void PropertyWidget_DropCap::handleDropCapOffset()
@@ -116,7 +135,16 @@
 	if (!m_doc) return;
 	ParagraphStyle newStyle;
 	newStyle.setDropCapOffset(dropCapOffset->value());
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	newStyle.setHasDropCap(dropCapBox->isChecked());
+	PageItem *i2 = m_doc->m_Selection->itemAt(0);
+	if (m_doc->appMode == modeEditTable)
+		i2 = i2->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
 }
 
 void PropertyWidget_DropCap::handleDropCapCharStyle()
@@ -126,7 +154,16 @@
 	QString name = dropCapCharStyleCombo->currentText();
 	if (!name.isEmpty())
 		newStyle.setDcCharStyleName(name);
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	newStyle.setHasDropCap(dropCapBox->isChecked());
+	PageItem *i2 = m_doc->m_Selection->itemAt(0);
+	if (m_doc->appMode == modeEditTable)
+		i2 = i2->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
 }
 
 void PropertyWidget_DropCap::changeEvent(QEvent *e)

Modified: trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17353&path=/trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp (original)
+++ trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp Sun Mar  4 17:42:46 2012
@@ -7,6 +7,7 @@
 
 #include "propertywidget_textcolor.h"
 
+#include "pageitem_table.h"
 #include "scribus.h"
 #include "selection.h"
 #include "util_icon.h"
@@ -98,12 +99,20 @@
 
 	if (m_item)
 	{
-		revertButton->setChecked(m_item->reversed());
-		if (m_item->asTextFrame() || m_item->asPathText())
+		PageItem_TextFrame *i2;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		else
+			i2 = m_item->asTextFrame();
+		if (i2 != 0)
+			revertButton->setChecked(i2->reversed());
+		if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable())
 		{
 			ParagraphStyle parStyle =  m_item->itemText.defaultStyle();
 			if (m_doc->appMode == modeEdit)
 				m_item->currentTextProps(parStyle);
+			else if (m_doc->appMode == modeEditTable)
+				m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle);
 			updateStyle(parStyle);
 		}
 		connectSignals();
@@ -151,7 +160,7 @@
 	bool enabled = false;
 	if (m_item && m_doc)
 	{
-		if (m_item->asPathText() || m_item->asTextFrame())
+		if (m_item->asPathText() || m_item->asTextFrame() || m_item->asTable())
 			enabled = true;
 		if ((m_item->isGroup()) && (!m_item->isSingleSel))
 			enabled = false;
@@ -294,7 +303,17 @@
 {
 	int x = qRound(textEffects->OutlineVal->LWidth->value() * 10.0);
 	if ((m_doc) && (m_item))
-		m_doc->itemSelection_SetOutlineWidth(x);
+	{
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_doc->itemSelection_SetOutlineWidth(x, &tempSelection);
+		}
+	}
 }
 
 void PropertyWidget_TextColor::handleShadowOffs()
@@ -303,7 +322,15 @@
 	{
 		int x = qRound(textEffects->ShadowVal->Xoffset->value() * 10.0);
 		int y = qRound(textEffects->ShadowVal->Yoffset->value() * 10.0);
-		m_doc->itemSelection_SetShadowOffsets(x, y);
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_doc->itemSelection_SetShadowOffsets(x, y, &tempSelection);
+		}
 	}
 }
 
@@ -313,7 +340,15 @@
 	{
 		int x = qRound(textEffects->StrikeVal->LPos->value() * 10.0);
 		int y = qRound(textEffects->StrikeVal->LWidth->value() * 10.0);
-		m_doc->itemSelection_SetStrikethru(x, y);
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_doc->itemSelection_SetStrikethru(x, y, &tempSelection);
+		}
 	}
 }
 
@@ -321,21 +356,45 @@
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetItemTextReversed(revertButton->isChecked());
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetItemTextReversed(revertButton->isChecked(), &tempSelection);
+	}
 }
 
 void PropertyWidget_TextColor::handleTextFill()
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetFillColor(fillColor->currentColor());
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetFillColor(fillColor->currentColor(), &tempSelection);
+	}
 }
 
 void PropertyWidget_TextColor::handleTextStroke()
 {
 	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_doc->itemSelection_SetStrokeColor(strokeColor->currentColor());
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetStrokeColor(strokeColor->currentColor(), &tempSelection);
+	}
 }
 
 void PropertyWidget_TextColor::handleTextShade()
@@ -345,12 +404,28 @@
 	if (strokeShade == sender())
 	{
 		int b = strokeShade->getValue();
-		m_doc->itemSelection_SetStrokeShade(b);
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_doc->itemSelection_SetStrokeShade(b, &tempSelection);
+		}
 	}
 	else
 	{
 		int b = fillShade->getValue();
-		m_doc->itemSelection_SetFillShade(b);
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_doc->itemSelection_SetFillShade(b, &tempSelection);
+		}
 	}
 }
 
@@ -358,7 +433,16 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	m_ScMW->setItemEffects(s);
+	PageItem *i2 = m_item;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		m_doc->itemSelection_SetEffects(s, &tempSelection);
+		m_ScMW->setStyleEffects(s);
+	}
 }
 
 void PropertyWidget_TextColor::displayUnderline(double p, double w)
@@ -375,7 +459,15 @@
 	{
 		int x = qRound(textEffects->UnderlineVal->LPos->value() * 10.0);
 		int y = qRound(textEffects->UnderlineVal->LWidth->value() * 10.0);
-		m_doc->itemSelection_SetUnderline(x, y);
+		PageItem *i2 = m_item;
+		if (m_doc->appMode == modeEditTable)
+			i2 = m_item->asTable()->activeCell().textFrame();
+		if (i2 != NULL)
+		{
+			Selection tempSelection(this, false);
+			tempSelection.addItem(i2, true);
+			m_doc->itemSelection_SetUnderline(x, y, &tempSelection);
+		}
 	}
 }
 




More information about the scribus-commit mailing list