Example #1
0
/*! This method finds the attribute indicated by name
	 \param szName (the name of the attribute the value of which to find)
	 and assigns its value to
	 \param szValue (the value found of the attribute requested)
	 or returns false if the attributes as a whole or the attribute requested are not found.
	 It returns
	 \return whether or not the operation succeeded.

	 WARNING: Be sure to check the return value before trying to work with szValue.
*/
bool PP_AttrProp::getAttribute(const gchar * szName, const gchar *& szValue) const
{
	if (!m_pAttributes)
		return false;

	const gchar * pEntry = m_pAttributes->pick(szName);
	if (!pEntry)
		return false;

	szValue = pEntry;


	xxx_UT_DEBUGMSG(("SEVIOR: getAttribute Found value %s \n",szValue));

	return true;
}
Example #2
0
// Pushes the current state RTF state onto the state stack
//
bool IE_Imp_RTF::PushRTFState(void)
{
	xxx_UT_DEBUGMSG(("Push RTF state \n"));
	// Create a new object to store the state in
	RTFStateStore* pState = new RTFStateStore;
	if (pState == NULL)	{
	    UT_DEBUGMSG(("PushRTFState(): no state\n"));
	    return false;
	}
	*pState = m_currentRTFState;
	m_stateStack.push(pState);

	// Reset the current state
	m_currentRTFState.m_internalState = RTFStateStore::risNorm;
	return true;
}
void ODi_StylesStream_ListenerState::endElement (const gchar* pName,
                                                ODi_ListenerStateAction& rAction)
{
    if (!strcmp (pName, "office:document-styles")) {
        // We're done.
        rAction.popState();
    }
    if(!strcmp (pName, "text:outline-style"))
    {
      m_bOutlineStyle = false;
      //
      // Don't pop here it's done ODi_Style_List
      //
      xxx_UT_DEBUGMSG(("Finished text:outline-style \n"));
    }
}
Example #4
0
void XAP_UnixDialog_Print::BeginPrint(GtkPrintContext   *context)
{
    // Note: Help landscape printing survive, don't do anything on the cairo
    // context in this function.  Any transformations etc. shall take place in
    // PrintPage, because GtkPrint may do some transformations itself (which
    // will come out differently if we scale here).
	cairo_t* cr = gtk_print_context_get_cairo_context (context);
	//
	// The cairo context is automatically unref'd at the end of the print
	// so we need to reference it to allow it to be deleted by the PrintGraphics
	// class
	cairo_reference(cr);
	gtk_print_operation_set_n_pages (m_pPO,m_iNumberPages);
	AP_FrameData *pFrameData = static_cast<AP_FrameData *>(m_pFrame->getFrameData());

	xxx_UT_DEBUGMSG(("Initial Cairo Context %x \n",cr));
	m_pPrintGraphics = (GR_Graphics *) new GR_CairoPrintGraphics(cr, gr_PRINTRES);

	double ScreenRes = m_pView->getGraphics()->getDeviceResolution();
	static_cast<GR_CairoPrintGraphics *>(m_pPrintGraphics)
        ->setResolutionRatio(gr_PRINTRES/ScreenRes);

	if(m_pView->getViewMode() == VIEW_PRINT )
	{
			m_pPrintLayout = m_pDL;
			m_pPrintView = m_pView;
			m_pPrintLayout->setQuickPrint(m_pPrintGraphics);
			m_bDidQuickPrint = true;
			if(pFrameData->m_bShowPara)
			{
				m_pPrintView->setShowPara(false);
				m_bShowParagraphs = true;
			}
			else
				m_bShowParagraphs = false;
	}
	else
	{
			m_pPrintLayout = new FL_DocLayout(m_pView->getDocument(),m_pPrintGraphics);
			m_pPrintView = new FV_View(XAP_App::getApp(),0,m_pPrintLayout);
			m_pPrintView->getLayout()->fillLayouts();
			m_pPrintView->getLayout()->formatAll();
			m_pPrintView->getLayout()->recalculateTOCFields();
			m_bDidQuickPrint = false;
	}
	m_pPrintGraphics->startPrint();
}
Example #5
0
GR_XPRenderInfo::~GR_XPRenderInfo()
{
	--s_iClassInstanceCount;
	if(!s_iClassInstanceCount)
	{
		delete [] s_pCharBuff;    s_pCharBuff = NULL;
		delete [] s_pWidthBuff;   s_pWidthBuff = NULL;
		delete [] s_pAdvances;    s_pAdvances = NULL;

		s_pOwner = NULL;
	}
	xxx_UT_DEBUGMSG(("Deleting GR_XPRenderInfo %x \n",this));
    delete [] m_pChars;
	delete [] m_pWidths;
	m_pChars = NULL;
	m_pWidths = NULL;
}
/*!
 * Sniff the byte buffer to see if it contains vaild image data recognized
 * by gdk-pixbuf
 */
UT_Confidence_t IE_ImpGraphicGdkPixbuf_Sniffer::recognizeContents(const char * szBuf, UT_uint32 iNum)
{

	//
	//  Handle xpm differently coz the standard gdk-pixbuf loader scheme doesn't
	// work for these!
	//
	xxx_UT_DEBUGMSG(("gdk-pixbuf sniff happenning data %s \n",szBuf));
	if((iNum > 9) && (strncmp (szBuf, "/* XPM */", 9) == 0))
	{
		return UT_CONFIDENCE_PERFECT;
	}

	if (_gdk_pixbuf_get_module((guchar *)szBuf, iNum))
		return UT_CONFIDENCE_GOOD;
	return UT_CONFIDENCE_ZILCH;
}
Example #7
0
/* Declared in ut_xml.h as: void UT_XML::charData (const gchar * buffer, int length);
 */
void UT_XML::charData (const char * buffer, int length)
{
  if (m_bStopped) return;
  xxx_UT_DEBUGMSG(("In UT_XML::charData \n"));
  if (m_chardata_length && !m_is_chardata) flush_all ();

  m_is_chardata = true;

  if (!grow (m_chardata_buffer, m_chardata_length, m_chardata_max, length))
    {
      m_bStopped = true;
      return;
    }
  memcpy (m_chardata_buffer + m_chardata_length, buffer, length);
  m_chardata_length += length;
  m_chardata_buffer[m_chardata_length] = 0;
}
/*!
 * Return the DocSectionLayout that owns this
 */
fl_DocSectionLayout * fp_ContainerObject::getDocSectionLayout(void)
{
    fl_ContainerLayout * pCL = static_cast<fl_ContainerLayout *>(getSectionLayout());
    while(pCL && (pCL->getContainerType() != FL_CONTAINER_DOCSECTION) && (pCL->getContainerType() != FL_CONTAINER_HDRFTR))
    {
        xxx_UT_DEBUGMSG(("getDocSectionLayout: Container type %s \n",getContainerString()));
        pCL = pCL->myContainingLayout();
    }
    if(pCL && (pCL->getContainerType() == FL_CONTAINER_HDRFTR))
    {
        return static_cast<fl_HdrFtrSectionLayout *>(pCL)->getDocSectionLayout();
    }
    else if(pCL)
    {
        return static_cast<fl_DocSectionLayout *>(pCL);
    }
    return NULL;
}
void fp_EndnoteContainer::clearScreen(void)
{
	UT_DEBUGMSG(("Clearscreen on Endnote container %p , height = %d \n",this,getHeight()));
	fl_ContainerLayout * pCL = static_cast<fl_ContainerLayout *>(getSectionLayout());
	pCL->setNeedsRedraw();
	if(!m_bOnPage)
	{
		return;
	}
	if(m_bCleared)
	{
		return;
	}
	if(getColumn() && (getHeight() != 0))
	{
		if(getPage() == NULL)
		{
			return;
		}
		fl_DocSectionLayout * pDSL = getPage()->getOwningSection();
		if(pDSL == NULL)
		{
			return;
		}
		UT_sint32 iLeftMargin = pDSL->getLeftMargin();
		UT_sint32 iRightMargin = pDSL->getRightMargin();
		UT_sint32 iWidth = getPage()->getWidth();
		iWidth = iWidth - iLeftMargin - iRightMargin;
		UT_sint32 xoff,yoff;
		static_cast<fp_Column *>(getColumn())->getScreenOffsets(this,xoff,yoff);
		UT_sint32 srcX = getX();
		UT_sint32 srcY = getY();
		getFillType()->Fill(getGraphics(),srcX,srcY,xoff,yoff,iWidth,getHeight());
	}
	fp_Container * pCon = NULL;
	UT_sint32 i = 0;
	for(i=0; i< countCons(); i++)
	{
		xxx_UT_DEBUGMSG(("Clear screen on container %d in endnote \n",i));
		pCon = static_cast<fp_Container *>(getNthCon(i));
		pCon->clearScreen();
	}
	m_bCleared = true;
}
Example #10
0
// Pops the state off the top of the RTF stack and set the current state to it.
//
bool IE_Imp_RTF::PopRTFState(void)
{
	xxx_UT_DEBUGMSG(("Pop RTF state depth %d \n",m_stateStack.getDepth()));
	RTFStateStore* pState = NULL;
	m_stateStack.pop(reinterpret_cast<void**>(&pState));

	if (pState != NULL)	{
		bool ok = FlushStoredChars();
		m_currentRTFState = *pState;
		delete pState;

		m_currentRTFState.m_unicodeInAlternate = 0;
		return ok;
	}
	else {
		UT_DEBUGMSG(("RTF ERROR: pState is NULL! Will try to recover."));
		return false;
	}
}
Example #11
0
GR_XPRenderInfo::GR_XPRenderInfo(UT_UCS4Char *pChar,
				  UT_sint32 * pAdv,
				  UT_uint32 offset,
				  UT_uint32 len,
				  UT_uint32 iBufferSize,
				  GR_ScriptType type)
		:GR_RenderInfo(type),
		 m_pChars(pChar),
		 m_pWidths(NULL),
		 m_iBufferSize(iBufferSize),
		 m_pSegmentOffset(NULL),
		 m_iSegmentCount(0),
		 m_iSpaceWidthBeforeJustification(0xfffffff) // not one less 'f'
{
	m_iOffset = offset;
	m_iLength = len;
	xxx_UT_DEBUGMSG(("GR_XPRender %x constructed \n"));
	_constructorCommonCode();
};
Example #12
0
void pf_Fragments::insertFrag(pf_Frag * pfPlace, pf_Frag * pfNew)
{
	// insert the new fragment after the given fragment.
	UT_return_if_fail (pfPlace);
	UT_return_if_fail (pfNew);

	xxx_UT_DEBUGMSG(("Inserting frag %x of type %d after frag %x of type %d\n",pfNew,pfNew->getType(),pfPlace,pfPlace->getType()));

	pf_Frag * pfQ = pfPlace->getNext();
	
	pfNew->setNext(pfQ);
	if (pfQ)
		pfQ->setPrev(pfNew);
	pfNew->setPrev(pfPlace);
	pfPlace->setNext(pfNew);
	if (m_pLast == pfPlace)
		m_pLast = pfNew;
	setFragsDirty();
}
Example #13
0
/*!
 * This method clears out and repopulates the vector of pointers to fragments.
 * It also sets the doc Positions of all the fragments.
 */
void pf_Fragments::cleanFrags(void) const
{
	if (m_vecFrags.getItemCount() > 0)
		m_vecFrags.clear();

	pf_Frag * pfLast = NULL;
	PT_DocPosition sum = 0;
	for (pf_Frag * pf = getFirst(); (pf); pf=pf->getNext())
	{
		pf->setPos(sum);
		sum += pf->getLength();
		pfLast = pf;
		m_vecFrags.addItem((void *) pf);
	}
	
	UT_return_if_fail (pfLast /*&& (pfLast->getType() == pf_Frag::PFT_EndOfDoc)*/);
	xxx_UT_DEBUGMSG(("Found %d Frags dopos at end = %d \n",m_vecFrags.getItemCount(),getLast()->getPos()));
	m_bAreFragsClean = true;
	setCache(NULL);
}
Example #14
0
void FV_Selection::setSelectionAnchor(PT_DocPosition pos)
{
    m_iSelectAnchor = pos;
    fl_SectionLayout * pSL = m_pView->m_pLayout->getLastSection();
    if(pSL == NULL)
        return;
    PT_DocPosition posLow = m_iSelectAnchor;
    PT_DocPosition posHigh = m_pView->getPoint();
    if(posHigh < posLow)
    {
        posHigh = m_iSelectAnchor;
        posLow = m_pView->getPoint();
    }
    PT_DocPosition posBeg,posEnd=0;
    m_pView->getEditableBounds(false,posBeg);
    m_pView->getEditableBounds(true,posEnd);
    xxx_UT_DEBUGMSG(("posLow %d posBeg %d posHigh %d posEnd %d\n",posLow,posBeg,posHigh,posEnd));
    bool bSelAll = ((posBeg >= posLow) && (posEnd <= posHigh));
    setSelectAll(bSelAll);
}
Example #15
0
/*! 
    \param doc - the document which we want to iterate
    \param sdh - handle of the strux we want to start from
    \param offset - offset relative to strux we want to start from
    \param maxOffset - the upper limit of offset
*/
PD_StruxIterator::PD_StruxIterator(pf_Frag_Strux* sdh,UT_uint32 offset,
								   UT_uint32 maxOffset)
	: m_pPT(NULL), m_offset(offset),
	  m_frag_offset(0),  m_sdh(sdh),
	  m_frag(NULL),
	  m_status(UTIter_OK),
	  m_max_offset(maxOffset),
	  m_strux_len(0)
{
	UT_return_if_fail(m_sdh);
	m_frag = static_cast<const pf_Frag *>(m_sdh);
	m_pPT = const_cast<pf_Frag *>(m_frag)->getPieceTable();

	// save the length of this strux, so we can test for out of bounds
	// condition on the low end
	m_strux_len = m_frag->getLength();
		
	_findFrag();
	xxx_UT_DEBUGMSG(("sizeof PD_StruxIterator: %d\n", sizeof(PD_StruxIterator)));
}
Example #16
0
void s_XSL_FO_Listener::_tagClose(UT_uint32 tagID, const UT_UTF8String & content, bool newline)
{
	UT_uint32 i = 0;

	m_pie->write("</");
	m_pie->write("fo:");  //this might be unnecessary one day, so keep this here for easier removal (see bug 4355, comment 6)
	m_pie->write(content.utf8_str());
	m_pie->write(">");

	if(newline)
		m_pie->write("\n");

	m_utnsTagStack.pop((UT_sint32*)&i);
	m_iLastClosed = i;
	xxx_UT_DEBUGMSG(("XSL-FO export: Popping %d off of stack\n",i));

	if(i != tagID)
	{
		UT_DEBUGMSG(("XSL-FO export: possible mismatched tag. Requested: %d, Popped: %d\n",tagID,i));
	}
}
void fp_FootnoteContainer::clearScreen(void)
{
	if(getPage() == NULL)
	{
		return;
	}
	UT_sint32 pos = getPage()->findFootnoteContainer(this);
	if(pos == 0)
	{
		fl_DocSectionLayout * pDSL = getPage()->getOwningSection();
		const UT_RGBColor * pBGColor = getFillType()->getColor();
		UT_sint32 iLeftMargin = pDSL->getLeftMargin();
		UT_sint32 iRightMargin = pDSL->getRightMargin();
//		UT_sint32 diff = getPage()->getWidth()/10;
		UT_sint32 diff = 0; // FIXME make a property
		UT_sint32 xoff,yoff;
		getPage()->getScreenOffsets(this,xoff,yoff);
		UT_sint32 xoffStart = xoff  + diff;
		UT_sint32 width = (getPage()->getWidth() - iLeftMargin -iRightMargin)/3;
		UT_sint32 xoffEnd = xoff + width;

		getGraphics()->setColor(*pBGColor);
		UT_sint32 iLineThick = pDSL->getFootnoteLineThickness();
		getGraphics()->setLineWidth(iLineThick);
		UT_sint32 yline = yoff;
		yline = yline - iLineThick - 4; // FIXME This should not be a magic numer!
		xxx_UT_DEBUGMSG(("fp_TableContainer: clearScreen (%d,%d) to (%d,%d) \n",xoffStart,yline,xoffEnd,yline));
		UT_sint32 srcX = getX() + diff -1;
		UT_sint32 srcY = getY() - iLineThick -4;
		getFillType()->Fill(getGraphics(),srcX,srcY,xoffStart-1, yline, xoffEnd-xoffStart +2, iLineThick+1);
	}

	fp_Container * pCon = NULL;
	UT_sint32 i = 0;
	for(i=0; i< countCons(); i++)
	{
		pCon = static_cast<fp_Container *>(getNthCon(i));
		pCon->clearScreen();
	}
}
GR_Font* GR_Graphics::findFont(const char* pszFontFamily,
							   const char* pszFontStyle,
							   const char* pszFontVariant,
							   const char* pszFontWeight,
							   const char* pszFontStretch,
							   const char* pszFontSize,
							   const char* pszLang)
{
	GR_Font * pFont = NULL;

	// NOTE: we currently favor a readable hash key to make debugging easier
	// TODO: speed things up with a smaller key (the three AP pointers?)
	std::string key = UT_std_string_sprintf("%s;%s;%s;%s;%s;%s",pszFontFamily, 
											pszFontStyle, pszFontVariant, 
											pszFontWeight, pszFontStretch, 
											pszFontSize);

	FontCache::const_iterator iter = m_hashFontCache.find(key);
	if (iter == m_hashFontCache.end())
	{
		// TODO -- note that we currently assume font-family to be a single name,
		// TODO -- not a list.  This is broken.

		pFont = _findFont(pszFontFamily, pszFontStyle,
						  pszFontVariant,pszFontWeight,
						  pszFontStretch, pszFontSize,
						  pszLang);
		UT_ASSERT(pFont);
		xxx_UT_DEBUGMSG(("Insert font %x in gr_Graphics cache \n",pFont));
		// add it to the cache
		
		if(pFont)
			m_hashFontCache.insert(std::make_pair(key, pFont));
	}
	else
	{
		pFont = iter->second;
	}
	return pFont;
}
Example #19
0
fl_EndnoteLayout::~fl_EndnoteLayout()
{
	// NB: be careful about the order of these
	xxx_UT_DEBUGMSG(("Deleting Endlayout %x \n",this));
	_purgeLayout();
	fp_EndnoteContainer * pEC = static_cast<fp_EndnoteContainer *>(getFirstContainer());
	while(pEC)
	{
		fp_EndnoteContainer * pNext = static_cast<fp_EndnoteContainer *>(pEC->getNext());
		if(pEC == static_cast<fp_EndnoteContainer *>(getLastContainer()))
		{
			pNext = NULL;
		}
		m_pLayout->removeEndnoteContainer(pEC);
		delete pEC;
		pEC = pNext;
	}

	setFirstContainer(NULL);
	setLastContainer(NULL);
	m_pLayout->removeEndnote(this);
}
Example #20
0
/*!
 * This method returns the padding to be applied between a line approaching
 * wrapped frame or image from the right. 
 * y Is the top of the line in logical units as defined relative to the
 * y position on the screen.
 * height is the height of the line.
 * If tight wrapping is set on a positioned object this number can be negative
 * which means the line can encroach into the rectangular region of the
 * image provided the region is transparent.
 */
UT_sint32 fp_FrameContainer::getRightPad(UT_sint32 y, UT_sint32 height)
{
  fl_FrameLayout *pFL = static_cast<fl_FrameLayout *>(getSectionLayout());
  UT_sint32 pad = pFL->getBoundingSpace();
  UT_Rect * pRect = getScreenRect();
  UT_sint32 yC = pRect->top;
  if(!isTightWrapped() || !isWrappingSet())
  {
    return pad;
  }
  if(FL_FRAME_TEXTBOX_TYPE == pFL->getFrameType())
  {
    return pad;
  }
  if(pFL->getBackgroundImage() == NULL)
  {
    return pad;
  }
  UT_sint32 iRight = pFL->getBackgroundImage()->GetOffsetFromRight(getGraphics(),pad,y - yC,height);
  xxx_UT_DEBUGMSG(("Local Y %d iRight %d width %d \n",y-yC,iRight,getFullWidth()));
  return iRight;
}
Example #21
0
GR_Font* GR_Graphics::findFont(const char* pszFontFamily,
                               const char* pszFontStyle,
                               const char* pszFontVariant,
                               const char* pszFontWeight,
                               const char* pszFontStretch,
                               const char* pszFontSize,
                               const char* pszLang)
{
    GR_Font * pFont = NULL;

    // NOTE: we currently favor a readable hash key to make debugging easier
    // TODO: speed things up with a smaller key (the three AP pointers?)
    UT_String key;

    UT_String_sprintf(key,"%s;%s;%s;%s;%s;%s",pszFontFamily, pszFontStyle, pszFontVariant, pszFontWeight, pszFontStretch, pszFontSize);
    GR_Font *pEntry = m_hashFontCache.pick(key.c_str());
    if (!pEntry)
    {
        // TODO -- note that we currently assume font-family to be a single name,
        // TODO -- not a list.  This is broken.

        pFont = _findFont(pszFontFamily, pszFontStyle,
                          pszFontVariant,pszFontWeight,
                          pszFontStretch, pszFontSize,
                          pszLang);
        UT_ASSERT(pFont);
        xxx_UT_DEBUGMSG(("Insert font %x in gr_Graphics cache \n",pFont));
        // add it to the cache

        if(pFont)
            m_hashFontCache.insert(key.c_str(), pFont);
    }
    else
    {
        pFont = pEntry;
    }
    return pFont;
}
bool fp_TOCContainer::isInBrokenTOC(fp_Container * pCon)
{
//
// OK A container is allowed in this broken TOC if it's
// Y location plus height lie between getYBreak() and getYBottom.
//
	//
	// Short circuit things if the BrokenContainer pointer is set.
    //
 	if(pCon->getMyBrokenContainer() == static_cast<fp_Container *>(this))
 	{
 		return true;
 	}
 	if(pCon->getMyBrokenContainer() != NULL)
 	{
 		return false;
 	}
	UT_sint32 iTop = 0;
	iTop = pCon->getY();
	UT_sint32 iHeight = pCon->getHeight();

	UT_sint32 iBot = iTop + iHeight;

	UT_sint32 iBreak = getYBreak();
	UT_sint32 iBottom = getYBottom();
	xxx_UT_DEBUGMSG(("Column %x iTop = %d ybreak %d iBot= %d ybottom= %d \n",getBrokenColumn(),iTop,iBreak,iBot,iBottom));
	if(iBot >= iBreak)
	{
		if(iBot < iBottom)
		{
			//			pCon->setMyBrokenContainer(this);
			return true;
		}

	}
	return false;

}
Example #23
0
fl_FootnoteLayout::~fl_FootnoteLayout()
{
	// NB: be careful about the order of these
	xxx_UT_DEBUGMSG(("Deleting Footlayout %x \n",this));
	_purgeLayout();
	fp_FootnoteContainer * pFC = static_cast<fp_FootnoteContainer *>(getFirstContainer());
	while(pFC)
	{
		fp_FootnoteContainer * pNext = static_cast<fp_FootnoteContainer *>(pFC->getNext());
		if(pFC == static_cast<fp_FootnoteContainer *>(getLastContainer()))
		{
			pNext = NULL;
		}
		delete pFC;
		pFC = pNext;
	}

	setFirstContainer(NULL);
	setLastContainer(NULL);

	UT_return_if_fail( m_pLayout );
	m_pLayout->removeFootnote(this);
}
Example #24
0
void px_ChangeHistory::coalesceHistory(const PX_ChangeRecord * pcr)
{
	// coalesce this record with the current undo record.

	UT_sint32 iAdj = m_iAdjustOffset;
	PX_ChangeRecord * pcrUndo = m_vecChangeRecords.getNthItem(m_undoPosition-1);
	UT_return_if_fail (pcrUndo);
	UT_return_if_fail (pcr->getType() == pcrUndo->getType());

	switch (pcr->getType())
	{
		case PX_ChangeRecord::PXT_InsertSpan:
		case PX_ChangeRecord::PXT_DeleteSpan:
			{
				const PX_ChangeRecord_Span * pcrSpan = static_cast<const PX_ChangeRecord_Span *>(pcr);
				PX_ChangeRecord_Span * pcrSpanUndo = static_cast<PX_ChangeRecord_Span *>(pcrUndo);

				if(pcr->isFromThisDoc())
				{
				  _invalidateRedo();
				  m_iAdjustOffset = 0;
				}
				else if(iAdj > 0) 
				{
				    m_iAdjustOffset = iAdj - 1;
				    xxx_UT_DEBUGMSG(("AdjustOffset decremented - 3 %d ", m_iAdjustOffset));

				}
				pcrSpanUndo->coalesce(pcrSpan);
			}
			return;

		default:
			UT_ASSERT_HARMLESS(0);
			return;
	}
}
Example #25
0
void fp_FrameContainer::clearScreen(void)
{
	fp_Page * pPage = getPage();
	if(pPage == NULL)
	{
		return;
	}
	if(getView() == NULL)
	{
		return;
	}

	UT_sint32 srcX,srcY;
	UT_sint32 xoff,yoff;
	getView()->getPageScreenOffsets(pPage,xoff,yoff);
	xxx_UT_DEBUGMSG(("pagescreenoffsets xoff %d yoff %d \n",xoff,yoff));
	UT_sint32 leftThick = m_lineLeft.m_thickness;
	UT_sint32 rightThick = m_lineRight.m_thickness;
	UT_sint32 topThick = m_lineTop.m_thickness;
	UT_sint32 botThick = m_lineBottom.m_thickness;

	srcX = getFullX() - leftThick;
	srcY = getFullY() - topThick;

	xoff += getFullX() - leftThick;
	yoff += getFullY() - topThick;
	getFillType()->getParent()->Fill(getGraphics(),srcX,srcY,xoff,yoff,getFullWidth()+leftThick+rightThick,getFullHeight()+topThick+botThick+getGraphics()->tlu(1) +1);
	fp_Container * pCon = NULL;
	UT_sint32 i = 0;
	for(i=0; i< countCons(); i++)
	{
		pCon = static_cast<fp_Container *>(getNthCon(i));
		pCon->clearScreen();
	}
	m_bNeverDrawn = true;
}
Example #26
0
/* just a little helper function
 */
void fp_FrameContainer::_drawLine (const PP_PropertyMap::Line & style,
								  UT_sint32 left, UT_sint32 top, UT_sint32 right, UT_sint32 bot,GR_Graphics * pGr)
{
	GR_Painter painter(pGr);

	if (style.m_t_linestyle == PP_PropertyMap::linestyle_none)
		return; // do not draw	
	
	GR_Graphics::JoinStyle js = GR_Graphics::JOIN_MITER;
	GR_Graphics::CapStyle  cs = GR_Graphics::CAP_PROJECTING;

	UT_sint32 iLineWidth = static_cast<UT_sint32>(style.m_thickness);
	pGr->setLineWidth (iLineWidth);
	pGr->setColor (style.m_color);

	switch (style.m_t_linestyle)
	{
		case PP_PropertyMap::linestyle_dotted:
			pGr->setLineProperties (iLineWidth, js, cs, GR_Graphics::LINE_DOTTED);
			break;
		case PP_PropertyMap::linestyle_dashed:
			pGr->setLineProperties (iLineWidth, js, cs, GR_Graphics::LINE_ON_OFF_DASH);
			break;
		case PP_PropertyMap::linestyle_solid:
			pGr->setLineProperties (iLineWidth, js, cs, GR_Graphics::LINE_SOLID);
			break;
		default: // do nothing; shouldn't happen
			break;
	}

	xxx_UT_DEBUGMSG(("_drawLine: top %d bot %d \n",top,bot));

	painter.drawLine (left, top, right, bot);
	
	pGr->setLineProperties (pGr->tlu(1), js, cs, GR_Graphics::LINE_SOLID);
}
Example #27
0
void fl_FrameLayout::updateLayout(bool /*bDoAll*/)
{
	// ingnore frames in normal view mode
	FV_View * pView = getDocLayout()->getView();
	GR_Graphics * pG = getDocLayout()->getGraphics();
	UT_return_if_fail( pView && pG);
	
	xxx_UT_DEBUGMSG(("UpdsateLayout in in framelayout \n"));
	if(needsReformat())
	{
		format();
	}
	m_vecFormatLayout.clear();
	fl_ContainerLayout*	pBL = getFirstLayout();
	while (pBL)
	{
		if (pBL->needsReformat())
		{
			pBL->format();
		}

		pBL = pBL->getNext();
	}
}
Example #28
0
bool XAP_Dictionary::isWord(const UT_UCSChar * pWord, UT_uint32 len) const
{
	char * key = static_cast<char*>(UT_calloc(len+1, sizeof(char)));
	if (!key)
	{
		UT_DEBUGMSG(("mem failure looking up word in dictionary\n"));
		FREEP(key);
		return false;
	}
	UT_uint32 i =0;
	for (i = 0; i < len; i++)
	{
		key[i] = static_cast<char>(static_cast<unsigned char>( pWord[i] ));
		xxx_UT_DEBUGMSG(("isword key[%d] = %c %d \n",i,key[i],key[i]));
		if(key[i] == 0)
			break;
	}
	key[i] = 0;
	char * key2 = g_strdup(key);
	bool contains = m_hashWords.contains (key2, NULL);
	FREEP(key);
	FREEP(key2);
	return contains;
}
Example #29
0
pf_Frag_Object::pf_Frag_Object(pt_PieceTable * pPT,
                               PTObjectType objectType,
                               PT_AttrPropIndex indexAP)
    : pf_Frag(pPT, pf_Frag::PFT_Object, pf_FRAG_OBJECT_LENGTH)
{
	m_pObjectSubclass = NULL;
    m_objectType = objectType;
    m_indexAP = indexAP;
    const PP_AttrProp * pAP = NULL;
	xxx_UT_DEBUGMSG(("Frag Object created indexAP %x \n",m_indexAP));
    m_pPieceTable->getAttrProp(m_indexAP,&pAP);
    UT_return_if_fail (pAP);
    const gchar* pszType = NULL;
    const gchar* pszName = NULL;
	const gchar* pszParam = NULL;

    pAP->getAttribute(static_cast<const gchar *>("type"), pszType);
    pAP->getAttribute(static_cast<const gchar *>("name"), pszName);
    pAP->getAttribute(static_cast<const gchar *>("param"), pszParam);

    fd_Field::FieldType fieldType = fd_Field::FD_None;

    if (objectType==PTO_Field) 
    {
		if(pszType == NULL)
		{
			UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
			pszType = "test";
		}
    	switch(*pszType)
    	{
    		case 'a':
				if (0 == strcmp(pszType, "app_ver"))
				{
					fieldType = fd_Field::FD_App_Version;
				}
				else if (0 == strcmp(pszType, "app_id"))
				{
					fieldType = fd_Field::FD_App_ID;
				}
				else if (0 == strcmp(pszType, "app_options"))
				{
					fieldType = fd_Field::FD_App_Options;
				}
				else if (0 == strcmp(pszType, "app_target"))
				{
					fieldType = fd_Field::FD_App_Target;
				}
				else if (0 == strcmp(pszType, "app_compiledate"))
				{
					fieldType = fd_Field::FD_App_CompileDate;
				}
				else if (0 == strcmp(pszType, "app_compiletime"))
				{
					fieldType = fd_Field::FD_App_CompileTime;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
				break;
    		case 'c':
				if (0 == strcmp(pszType, "char_count"))
				{
					fieldType = fd_Field::FD_Doc_CharCount;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
    			break;
    		case 'd':
				if (0 == strcmp(pszType, "date"))
				{
					fieldType = fd_Field::FD_Date;
				}
				else if (0 == strcmp(pszType, "date_mmddyy"))
				{
					fieldType = fd_Field::FD_Date_MMDDYY;
				}
				else if (0 == strcmp(pszType, "date_ddmmyy"))
				{
					fieldType = fd_Field::FD_Date_DDMMYY;
				}
				else if (0 == strcmp(pszType, "date_mdy"))
				{
					fieldType = fd_Field::FD_Date_MDY;
				}
				else if (0 == strcmp(pszType, "date_mthdy"))
				{
					fieldType = fd_Field::FD_Date_MthDY;
				}
				else if (0 == strcmp(pszType, "date_dfl"))
				{
					fieldType = fd_Field::FD_Date_DFL;
				}
				else if (0 == strcmp(pszType, "date_ntdfl"))
				{
					fieldType = fd_Field::FD_Date_NTDFL;
				}
				else if (0 == strcmp(pszType, "date_wkday"))
				{
					fieldType = fd_Field::FD_Date_Wkday;
				}
				else if (0 == strcmp(pszType, "date_doy"))
				{
					fieldType = fd_Field::FD_Date_DOY;
				}
				else if (0 == strcmp(pszType, "datetime_custom"))
				{
					fieldType = fd_Field::FD_DateTime_Custom;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
				break;
    		case 'e':
				if (0 == strcmp(pszType, "endnote_ref"))
				{
					fieldType = fd_Field::FD_Endnote_Ref;
				}
				else if (0 == strcmp(pszType, "endnote_anchor"))
				{
					fieldType = fd_Field::FD_Endnote_Anchor;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
				break;
    		case 'f':
				if (0 == strcmp(pszType, "file_name"))
				{
					fieldType = fd_Field::FD_FileName;
				}
				else if (0 == strcmp(pszType, "footnote_ref"))
				{
					fieldType = fd_Field::FD_Footnote_Ref;
				}
				else if (0 == strcmp(pszType, "footnote_anchor"))
				{
					fieldType = fd_Field::FD_Footnote_Anchor;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
				break;
    		case 'l':
				if (0 == strcmp(pszType, "list_label"))
		        {
        		    fieldType = fd_Field::FD_ListLabel;
		        }
				else if (0 == strcmp(pszType, "line_count"))
				{
					fieldType = fd_Field::FD_Doc_LineCount;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
    			break;
    		case 'm':
		        if (0 == strcmp(pszType, "mail_merge"))
		        {
        		    fieldType = fd_Field::FD_MailMerge;
		        }
			else if(0 == strcmp(pszType, "meta_title"))
			  {
			    fieldType = fd_Field::FD_Meta_Title;
			  }
			else if(0 == strcmp(pszType, "meta_creator"))
			  {
			    fieldType = fd_Field::FD_Meta_Creator;
			  }
			else if(0 == strcmp(pszType, "meta_subject"))
			  {
			    fieldType = fd_Field::FD_Meta_Subject;
			  }
			else if(0 == strcmp(pszType, "meta_publisher"))
			  {
			    fieldType = fd_Field::FD_Meta_Publisher;
			  }
			else if(0 == strcmp(pszType, "meta_date"))
			  {
			    fieldType = fd_Field::FD_Meta_Date;
			  }
			else if(0 == strcmp(pszType, "meta_type"))
			  {
			    fieldType = fd_Field::FD_Meta_Type;
			  }
			else if(0 == strcmp(pszType, "meta_language"))
			  {
			    fieldType = fd_Field::FD_Meta_Language;
			  }
			else if(0 == strcmp(pszType, "meta_rights"))
			  {
			    fieldType = fd_Field::FD_Meta_Rights;
			  }
			else if(0 == strcmp(pszType, "meta_keywords"))
			  {
			    fieldType = fd_Field::FD_Meta_Keywords;
			  }
			else if(0 == strcmp(pszType, "meta_contributor"))
			  {
			    fieldType = fd_Field::FD_Meta_Contributor;
			  }
			else if(0 == strcmp(pszType, "meta_coverage"))
			  {
			    fieldType = fd_Field::FD_Meta_Coverage;
			  }
			else if(0 == strcmp(pszType, "meta_description"))
			  {
			    fieldType = fd_Field::FD_Meta_Description;
			  }
		        else if (0 == strcmp(pszType, "martin_test"))
		        {
        		    fieldType = fd_Field::FD_MartinTest;
		        }
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
		        break;
    		case 'n':
				if (0 == strcmp(pszType, "nbsp_count"))
				{
					fieldType = fd_Field::FD_Doc_NbspCount;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
				break;
    		case 'p':
				if (0 == strcmp(pszType, "page_number"))
		        {
        		    fieldType = fd_Field::FD_PageNumber;
		        }
		        else if (0 == strcmp(pszType, "page_count"))
        		{
		            fieldType = fd_Field::FD_PageCount;
        		}
				else if (0 == strcmp(pszType, "para_count"))
				{
					fieldType = fd_Field::FD_Doc_ParaCount;
				}
				else if (0 == strcmp(pszType, "page_ref"))
				{
					fieldType = fd_Field::FD_PageReference;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
        		break;
		    case 's':
				if(0 == strcmp(pszType, "sum_rows"))
				{
					fieldType = fd_Field::FD_Table_sum_rows;
				}
				if(0 == strcmp(pszType, "sum_cols"))
				{
					fieldType = fd_Field::FD_Table_sum_cols;
				}
				break;
    		case 't':
		        if (0 == strcmp(pszType, "test"))
        		{
		            fieldType = fd_Field::FD_Test;
        		}
		        else if (0 == strcmp(pszType, "time"))
        		{
		            fieldType = fd_Field::FD_Time;
        		}
				else if (0 == strcmp(pszType, "time_miltime"))
				{
					fieldType = fd_Field::FD_Time_MilTime;
				}
				else if (0 == strcmp(pszType, "time_ampm"))
				{
					fieldType = fd_Field::FD_Time_AMPM;
				}
				else if (0 == strcmp(pszType, "time_zone"))
				{
					fieldType = fd_Field::FD_Time_Zone;
				}
				else if (0 == strcmp(pszType, "time_epoch"))
				{
					fieldType = fd_Field::FD_Time_Epoch;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
        		break;
    		case 'w':
				if (0 == strcmp(pszType, "word_count"))
				{
					fieldType = fd_Field::FD_Doc_WordCount;
				}
		        else
        		{
		            UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        		    //Better than segfaulting I figure
		            fieldType = fd_Field::FD_None;
        		}
				break;
#if 0
// When adding new fields under any of these characters, please move
// the label up where it belongs
    		case 'b':
    		case 'g':
    		case 'h':
    		case 'i':
    		case 'j':
    		case 'k':
    		case 'o':
    		case 'q':
    		case 'r':
    		case 's':
    		case 'u':
    		case 'v':
    		case 'x':
    		case 'y':
    		case 'z':
#endif
    		default:
    			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
       		    //Better than segfaulting I figure
	            fieldType = fd_Field::FD_None;
    	}
        m_pField = new fd_Field(*this, pPT,fieldType, pszParam);
    }
    else if (objectType==PTO_Bookmark)
    {
    	po_Bookmark::BookmarkType BT;
		
		if(!pszType) {
			// see bug 6489...
			UT_ASSERT_NOT_REACHED();
			BT = po_Bookmark::POBOOKMARK_END;
		} else if(0 == strcmp(pszType, "end"))
			BT = po_Bookmark::POBOOKMARK_END;
		else
			BT = po_Bookmark::POBOOKMARK_START;
			
		UT_return_if_fail (pszName && *pszName);
		m_pObjectSubclass = static_cast<void *>(new po_Bookmark(*this,pPT,BT, pszName));
    }

}
Example #30
0
void  FV_Selection::setSelectAll(bool bSelectAll)
{
    xxx_UT_DEBUGMSG(("Select All = %d \n",bSelectAll));
    m_bSelectAll = bSelectAll;
}