fix a leak, add some table features

This commit is contained in:
Alex Fabijanic
2020-01-15 22:06:45 +01:00
committed by Günter Obiltschnig
parent 854bf4d79f
commit b435db6e8e
7 changed files with 94 additions and 15 deletions

24
PDF/include/Poco/PDF/Cell.h Normal file → Executable file
View File

@@ -35,7 +35,7 @@ public:
};
Cell(const AttributedString& content = "", const std::string& name = "", FontMapPtr pFontMap = 0);
Cell(const AttributedString& content, FontMapPtr pFontMap, const std::string& encoding = "UTF-8" , bool trueType = true);
Cell(const AttributedString& content, FontMapPtr pFontMap, const std::string& encoding = "UTF-8" , bool trueType = true, int widthAsPct=-1);
~Cell();
const std::string& getName() const;
@@ -56,6 +56,9 @@ public:
void setFonts(FontMapPtr pFontMap);
FontMapPtr getFonts() const { return _pFontMap; }
void draw(Page& page, float x, float y, float width, float height);
int getWidthAsPct() const;
void setWidthAsPct(int width);
bool hasWidth() const;
private:
AttributedString _content;
@@ -65,6 +68,7 @@ private:
FontMapPtr _pFontMap;
std::string _encoding;
bool _trueType;
int _widthAsPct;
};
@@ -148,6 +152,24 @@ inline void Cell::setLineWidth(float width)
}
inline int Cell::getWidthAsPct() const
{
return _widthAsPct;
}
inline void Cell::setWidthAsPct(int width)
{
_widthAsPct = width;
}
inline bool Cell::hasWidth() const
{
return _widthAsPct > 0;
}
} } // namespace Poco::PDF

2
PDF/include/Poco/PDF/Font.h Normal file → Executable file
View File

@@ -30,7 +30,7 @@ class PDF_API Font: public Resource<HPDF_Font>
/// Font class represents font resource.
{
public:
Font(HPDF_Doc* pPDF, const HPDF_Font& resource);
Font(HPDF_Doc* pPDF, HPDF_Font resource);
/// Creates the font.
~Font();