r18036 by fschmid - PDF-Import: correct handling of annotation flags.

scribus-commit scribus-commit at lists.scribus.net
Thu Jan 3 10:59:33 UTC 2013


Author: fschmid
Date: Thu Jan  3 10:59:33 2013
New Revision: 18036

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18036
Log:
PDF-Import: correct handling of annotation flags.

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18036&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Thu Jan  3 10:59:33 2013
@@ -3115,6 +3115,12 @@
 	MarginStruct savedTextDistanceMargins(m_textDistanceMargins);
 	if (isAnnotation() && !((m_Doc->appMode == modeEdit) && (m_Doc->m_Selection->findItem(this) != -1)) && (((annotation().Type() > 1) && (annotation().Type() < 11)) || (annotation().Type() > 12)))
 	{
+
+		if ((m_Doc->drawAsPreview && !m_Doc->editOnPreview) && ((annotation().Vis() == 1) || (annotation().Vis() == 3)))
+		{
+			p->restore();
+			return;
+		}
 		QColor fontColor;
 		SetQColor(&fontColor, itemText.defaultStyle().charStyle().fillColor(), itemText.defaultStyle().charStyle().fillShade());
 		double fontSize = itemText.defaultStyle().charStyle().fontSize() / 10.0;

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18036&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp Thu Jan  3 10:59:33 2013
@@ -341,7 +341,9 @@
 	AnnotText *anl = (AnnotText*)annota;
 	int z = m_doc->itemAdd(PageItem::TextFrame, PageItem::Rectangle, xCoor, yCoor, width, height, 0, CommonStrings::None, CommonStrings::None, true);
 	PageItem *ite = m_doc->Items->at(z);
-	ite->setRotation(rotate, true);
+	int flg = annota->getFlags();
+	if (!(flg & 16))
+		ite->setRotation(rotate, true);
 	ite->ClipEdited = true;
 	ite->FrameType = 3;
 	ite->setFillEvenOdd(false);
@@ -483,7 +485,9 @@
 	{
 		int z = m_doc->itemAdd(PageItem::TextFrame, PageItem::Rectangle, xCoor, yCoor, width, height, 0, CommonStrings::None, CommonStrings::None, true);
 		PageItem *ite = m_doc->Items->at(z);
-		ite->setRotation(rotate, true);
+		int flg = annota->getFlags();
+		if (!(flg & 16))
+			ite->setRotation(rotate, true);
 		ite->ClipEdited = true;
 		ite->FrameType = 3;
 		ite->setFillEvenOdd(false);
@@ -628,7 +632,7 @@
 #else
 							gfx = new Gfx(xref, Adev, pdfDoc->getPage(m_actPage)->getResourceDict(), catalog, annota->getRect(), NULL);
 #endif
-							annota->draw(gfx, false);
+							ano->draw(gfx, false);
 							if (!bgFound)
 								CurrColorFill = Adev->CurrColorFill;
 							if (!fgFound)
@@ -642,7 +646,9 @@
 						}
 						int z = m_doc->itemAdd(PageItem::TextFrame, PageItem::Rectangle, xCoor, yCoor, width, height, 0, CurrColorFill, CommonStrings::None, true);
 						PageItem *ite = m_doc->Items->at(z);
-						ite->setRotation(rotate, true);
+						int flg = annota->getFlags();
+						if (!(flg & 16))
+							ite->setRotation(rotate, true);
 						ite->ClipEdited = true;
 						ite->FrameType = 3;
 						ite->setFillEvenOdd(false);
@@ -699,7 +705,11 @@
 								ite->annotation().setDown(tmTxt);
 						}
 						ite->annotation().setType(wtyp);
-						ite->annotation().setFlag(ano->getFlags());
+						ite->annotation().setFlag(0);
+						if (flg & 2)
+							ite->annotation().setVis(1);
+						if (flg & 32)
+							ite->annotation().setVis(3);
 						if (wtyp == Annotation::Button)
 						{
 							ite->setFillColor(CurrColorFill);
@@ -709,6 +719,9 @@
 								ite->itemText.insertChars(itemText);
 							applyTextStyle(ite, fontName, CurrColorText, fontSize);
 							ite->annotation().addToFlag(Annotation::Flag_PushButton);
+							FormWidgetButton *btn = (FormWidgetButton*)fm;
+							if (!btn->isReadOnly())
+								ite->annotation().addToFlag(Annotation::Flag_Edit);
 							handleActions(ite, ano);
 						}
 						else if (wtyp == Annotation::Textfield)
@@ -731,6 +744,8 @@
 									ite->annotation().setMaxChar(mxLen);
 								else
 									ite->annotation().setMaxChar(-1);
+								if (!btn->isReadOnly())
+									ite->annotation().addToFlag(Annotation::Flag_Edit);
 								handleActions(ite, ano);
 							}
 						}
@@ -756,6 +771,8 @@
 									ite->annotation().setChkStil(5);
 								else
 									ite->annotation().setChkStil(0);
+								if (!btn->isReadOnly())
+									ite->annotation().addToFlag(Annotation::Flag_Edit);
 							}
 						}
 						else if ((wtyp == Annotation::Combobox) || (wtyp == Annotation::Listbox))

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18036&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h Thu Jan  3 10:59:33 2013
@@ -127,6 +127,7 @@
 	virtual void eoFill(GfxState *state);
 	virtual void fill(GfxState *state);
 	virtual void drawString(GfxState *state, GooString *s);
+
 	QString CurrColorText;
 	QString CurrColorFill;
 	QString CurrColorStroke;

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18036&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Jan  3 10:59:33 2013
@@ -18092,7 +18092,8 @@
 						it->annotation().setCheckState(it->annotation().IsChk());
 					it->annotation().setOnState(false);
 					it->annotation().setOpen(false);
-					it->asTextFrame()->setTextAnnotationOpen(false);
+					if (it->annotation().Type() == Annotation::Text)
+						it->asTextFrame()->setTextAnnotationOpen(false);
 					it->update();
 				}
 			}
@@ -18115,7 +18116,8 @@
 					it->annotation().setCheckState(it->annotation().IsChk());
 				it->annotation().setOnState(false);
 				it->annotation().setOpen(false);
-				it->asTextFrame()->setTextAnnotationOpen(false);
+				if (it->annotation().Type() == Annotation::Text)
+					it->asTextFrame()->setTextAnnotationOpen(false);
 				it->update();
 			}
 		}
@@ -18141,7 +18143,8 @@
 						it->annotation().setCheckState(it->annotation().IsChk());
 					it->annotation().setOnState(false);
 					it->annotation().setOpen(false);
-					it->asTextFrame()->setTextAnnotationOpen(false);
+					if (it->annotation().Type() == Annotation::Text)
+						it->asTextFrame()->setTextAnnotationOpen(false);
 					it->update();
 				}
 			}




More information about the scribus-commit mailing list