26 #ifndef _CPAGECONTENTS_H_
27 #define _CPAGECONTENTS_H_
43 namespace pdfobjects {
75 ContentsWatchDog (
CPageContents* cnt) : _cnt(cnt) { assert(_cnt); }
76 virtual ~ContentsWatchDog()
throw() {}
78 virtual void notify (boost::shared_ptr<IProperty>, boost::shared_ptr<const IProperty::ObserverContext>)
const throw();
79 virtual priority_t getPriority()
const throw()
94 std::fill (_tm, _tm+6, 0); _tm[0] = _tm[3] = 1;
100 for (
size_t i = 0;
i < 6; ++
i)
104 { _tm[4] = p.x; _tm[5] = p.y; }
108 for (
const double* it = &_tm[0]; it != &_tm[6]; ++it)
109 _opers.push_back (boost::shared_ptr<IProperty>(
new CReal (*it)));
118 typedef std::vector<boost::shared_ptr<CContentStream> > CCs;
124 boost::shared_ptr<CDict> _dict;
125 boost::shared_ptr<ContentsWatchDog> _wd;
139 virtual void reset ();
165 template<
typename Container>
181 template<
typename Container>
191 void remove (
size_t csnum);
204 template<
typename RectangleContainer>
206 RectangleContainer& recs,
212 void replaceText (
const std::string& what,
const std::string& with);
217 void addText (
const std::string& what,
219 const std::string& font_id);
231 template<
typename WordEngine,
233 typename ColumnEngine>
241 boost::shared_ptr<GfxResources> gfxres;
242 boost::shared_ptr<GfxState> gfxstate;
243 _xpdf_display_params (gfxres, gfxstate);
244 assert (gfxres && gfxstate);
247 TextSource text_source;
251 for (CCs::iterator it = _ccs.begin(); it != _ccs.end(); ++it)
255 (*it)->getPdfOperators (ops);
259 StateUpdater::updatePdfOperators<TextSource&> (itt, gfxres, *gfxstate, text_source);
264 text_source.format ();
267 text_source.output (out, _page_pos());
269 text_source.output (out, 0);
285 template<
typename OpContainer,
typename PositionComparator>
290 for (CCs::iterator it = _ccs.begin (); it != _ccs.end(); ++it)
291 (*it)->getOperatorsAtPosition (opContainer, cmp);
307 template<
typename Container>
312 std::copy (_ccs.begin(), _ccs.end(), std::back_inserter(container));
327 void getText (std::string& text,
328 const std::string* encoding =
NULL,
334 void moveAbove (boost::shared_ptr<const CContentStream> ct);
340 void moveBelow (boost::shared_ptr<const CContentStream> ct);
354 template<
typename Cont>
355 static void setContents (boost::shared_ptr<CDict> dict,
const Cont& cont);
362 void toFront (
CRef& ref);
364 void toBack (
CRef& ref);
367 void remove (boost::shared_ptr<const CContentStream> cs);
369 void remove (
const IndiRef& rf);
397 inline void change (
bool invalid =
false);
406 void _xpdf_display_params (boost::shared_ptr<GfxResources>& res,
407 boost::shared_ptr<GfxState>& state);
411 size_t _page_pos ()
const;
426 void reg_observer (boost::shared_ptr<IProperty> ip = boost::shared_ptr<IProperty>())
const;
433 void unreg_observer (boost::shared_ptr<IProperty> ip = boost::shared_ptr<IProperty>())
const;
439 struct ContentsObserverFreeSection
442 ContentsObserverFreeSection (
CPageContents* cnt) : _cnt (cnt)
443 { _cnt->unreg_observer(); }
444 ~ContentsObserverFreeSection ()
445 { _cnt->reg_observer();}
455 #endif // _CPAGECONTENTS_H_