r21847 by craig - Complete switch in textcontext and remove unused variable in BaseStyle

scribus-commit scribus-commit at lists.scribus.net
Mon Mar 20 21:45:06 UTC 2017


Author: craig
Date: Mon Mar 20 21:45:06 2017
New Revision: 21847

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21847
Log:
Complete switch in textcontext and remove unused variable in BaseStyle

Modified:
    trunk/Scribus/scribus/styles/style.cpp
    trunk/Scribus/scribus/text/textcontext.cpp

Modified: trunk/Scribus/scribus/styles/style.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21847&path=/trunk/Scribus/scribus/styles/style.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/style.cpp	(original)
+++ trunk/Scribus/scribus/styles/style.cpp	Mon Mar 20 21:45:06 2017
@@ -79,14 +79,14 @@
 	if (!parentStyle)
 		return false;
 
-	bool  loop = false, parentLoop = false;
+	bool  parentLoop = false;
 
 	const BaseStyle* pStyle = parentStyle;
 	while (pStyle)
 	{
 		if (pStyle->hasParent() && (pStyle->parent() == m_name))
 		{
-			loop = parentLoop = true;
+			parentLoop = true;
 			break;
 		}
 		pStyle = pStyle->hasParent() ? pStyle->parentStyle() : NULL;

Modified: trunk/Scribus/scribus/text/textcontext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21847&path=/trunk/Scribus/scribus/text/textcontext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textcontext.cpp	(original)
+++ trunk/Scribus/scribus/text/textcontext.cpp	Mon Mar 20 21:45:06 2017
@@ -74,44 +74,53 @@
 										 doc->getSectionPageNumberFillCharForPageIndex(m_frame->OwnPage));
 			}
 			return "#";
-			
 		case ExpansionPoint::PageCount:
-		{
-			int key = doc->getSectionKeyForPageIndex(m_frame->OwnPage);
-			if (key == -1)
-				return "%";
-			return QString("%1").arg(getStringFromSequence(doc->sections()[key].type, doc->sections()[key].toindex - doc->sections()[key].fromindex + 1));
-		}
+			{
+				int key = doc->getSectionKeyForPageIndex(m_frame->OwnPage);
+				if (key == -1)
+					return "%";
+				return QString("%1").arg(getStringFromSequence(doc->sections()[key].type, doc->sections()[key].toindex - doc->sections()[key].fromindex + 1));
+			}
 		case ExpansionPoint::MarkCE:
-		{
-			Mark* mark = expansion.getMark();
-			
-			mark->OwnPage = m_frame->OwnPage;
-			//itemPtr and itemName set to this frame only if mark type is different than MARK2ItemType
-			if (!mark->isType(MARK2ItemType))
 			{
-				mark->setItemPtr(m_frame);
-				mark->setItemName(m_frame->itemName());
+				Mark* mark = expansion.getMark();
+
+				mark->OwnPage = m_frame->OwnPage;
+				//itemPtr and itemName set to this frame only if mark type is different than MARK2ItemType
+				if (!mark->isType(MARK2ItemType))
+				{
+					mark->setItemPtr(m_frame);
+					mark->setItemName(m_frame->itemName());
+				}
+
+				//anchors and indexes has no visible inserts in text
+				if (mark->isType(MARKAnchorType) || mark->isType(MARKIndexType))
+					return QString();
+
+				//set note marker charstyle
+				if (mark->isNoteType())
+				{
+					mark->setItemPtr(m_frame);
+
+
+					TextNote* note = mark->getNotePtr();
+					if (note == NULL)
+						return QString();
+
+				}
+				if ((mark != NULL) && !mark->isType(MARKAnchorType) && !mark->isType(MARKIndexType))
+					return mark->getString();
 			}
-			
-			//anchors and indexes has no visible inserts in text
-			if (mark->isType(MARKAnchorType) || mark->isType(MARKIndexType))
-				return QString();
-			
-			//set note marker charstyle
-			if (mark->isNoteType())
-			{
-				mark->setItemPtr(m_frame);
-				
-				
-				TextNote* note = mark->getNotePtr();
-				if (note == NULL)
-					return QString();
-				
-			}
-			if ((mark != NULL) && !mark->isType(MARKAnchorType) && !mark->isType(MARKIndexType))
-				return mark->getString();
-		}
+			break;
+		case ExpansionPoint::Invalid:
+		case ExpansionPoint::ListBullet:
+		case ExpansionPoint::ListCounter:
+		case ExpansionPoint::Note:
+		case ExpansionPoint::Anchor:
+		case ExpansionPoint::PageRef:
+		case ExpansionPoint::Lookup:
+		case ExpansionPoint::SectionRef:
+			break;
 	}
 	return QString();
 }




More information about the scribus-commit mailing list