survive missing writer component for testing purposes

This commit is contained in:
Caolán McNamara 2011-06-13 22:23:07 +01:00
parent 20a1afe407
commit bfd0bbab20
4 changed files with 34 additions and 30 deletions

View file

@ -42,11 +42,11 @@ extern LinkedList<Node> nodelist;
static hchar entity[32];
#define ascii(x) OUString::createFromAscii(x)
#define rstartEl(x,y) rDocumentHandler->startElement(x,y)
#define rendEl(x) rDocumentHandler->endElement(x)
#define rchars(x) rDocumentHandler->characters(ascii(x))
#define runistr(x) rDocumentHandler->characters(OUString(x))
#define reucstr(x,y) rDocumentHandler->characters(OUString(x,y, RTL_TEXTENCODING_EUC_KR))
#define rstartEl(x,y) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->startElement(x,y); } while(0)
#define rendEl(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->endElement(x); } while(0)
#define rchars(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(ascii(x)); } while(0)
#define runistr(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(OUString(x)); } while(0)
#define reucstr(x,y) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(OUString(x,y, RTL_TEXTENCODING_EUC_KR)); } while(0)
#define padd(x,y,z) pList->addAttribute(x,y,z)
#else
static char entity[32];

View file

@ -43,8 +43,8 @@ class Node;
using namespace ::com::sun::star::xml::sax;
// #endif
class Formula{
class Formula
{
public:
Formula(char *_eq, int _ishwpeq = 1)
: pList(NULL)
@ -55,10 +55,12 @@ public:
}
virtual ~Formula(){ }
void setDocumentHandler(Reference < XDocumentHandler > xHandler ){
rDocumentHandler = xHandler;
void setDocumentHandler(Reference < XDocumentHandler > xHandler )
{
m_rxDocumentHandler = xHandler;
}
void setAttributeListImpl( AttributeListImpl *p ){
void setAttributeListImpl( AttributeListImpl *p )
{
pList = p;
rList = (XAttributeList *) pList;
}
@ -87,7 +89,7 @@ private:
void makeEnd(Node *res);
private:
Reference< XDocumentHandler > rDocumentHandler;
Reference< XDocumentHandler > m_rxDocumentHandler;
Reference< XAttributeList > rList;
AttributeListImpl *pList;
char *eq;

View file

@ -51,9 +51,9 @@ extern int getRepFamilyName(const char* , char *, double &ratio);
// To be shorten source code by realking
#define hconv(x,y) OUString(hstr2ucsstr(x,y))
#define ascii(x) OUString::createFromAscii(x)
#define rstartEl(x,y) rDocumentHandler->startElement(x,y)
#define rendEl(x) rDocumentHandler->endElement(x)
#define rchars(x) rDocumentHandler->characters(x)
#define rstartEl(x,y) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->startElement(x,y); } while(0)
#define rendEl(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->endElement(x); } while(0)
#define rchars(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(x); } while(0)
#define padd(x,y,z) pList->addAttribute(x,y,z)
#define Double2Str(x) OUString::valueOf((double)(x))
#define WTI(x) ((double)(x) / 1800.) // unit => inch
@ -203,7 +203,8 @@ throw(SAXException, IOException, RuntimeException)
#endif
}
rDocumentHandler->startDocument();
if (m_rxDocumentHandler.is())
m_rxDocumentHandler->startDocument();
padd(ascii("office:class"), sXML_CDATA, ascii("text"));
padd(ascii("office:version"), sXML_CDATA, ascii("0.9"));
@ -236,7 +237,8 @@ throw(SAXException, IOException, RuntimeException)
rendEl(ascii("office:document"));
rDocumentHandler->endDocument();
if (m_rxDocumentHandler.is())
m_rxDocumentHandler->endDocument();
#ifndef UDK100
return sal_True;
#endif
@ -3763,7 +3765,7 @@ void HwpReader::makeFormula(TxtBox * hbox)
// rchars(ascii(mybuf));
//#ifndef UDK100
Formula *form = new Formula(mybuf);
form->setDocumentHandler(rDocumentHandler);
form->setDocumentHandler(m_rxDocumentHandler);
form->setAttributeListImpl(pList);
form->parse();

View file

@ -141,19 +141,19 @@ public:
virtual void SAL_CALL cancel() throw(RuntimeException) {}
virtual void SAL_CALL setDocumentHandler(Reference< XDocumentHandler > xHandler)
{
rDocumentHandler = xHandler;
m_rxDocumentHandler = xHandler;
}
void setUCB( Reference< XInterface > xUCB ){
void setUCB( Reference< XInterface > xUCB )
{
rUCB = xUCB;
}
private:
Reference< XDocumentHandler > rDocumentHandler;
Reference< XDocumentHandler > m_rxDocumentHandler;
Reference< XInterface > rUCB;
Reference< XAttributeList > rList;
AttributeListImpl *pList;
HWPFile hwpfile;
HwpReaderPrivate *d;
private:
/* -------- Document Parsing --------- */
void makeMeta();