1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef ADC_DISPLAY_HTMLFACTORY_HXX 29 #define ADC_DISPLAY_HTMLFACTORY_HXX 30 31 32 33 // USED SERVICES 34 // BASE CLASSES 35 // COMPONENTS 36 #include "outputstack.hxx" 37 // PARAMETERS 38 #include <udm/xml/xmlitem.hxx> 39 #include <udm/html/htmlitem.hxx> 40 41 namespace Xml = ::csi::xml; 42 namespace Html = ::csi::html; 43 44 /** @resp 45 Base class for HTML page creators (factories) for code entites or 46 similar items. 47 */ 48 template <class ENV> 49 class HtmlFactory 50 { 51 public: 52 // INQUIRY 53 ENV & Env() const { return *pEnv; } 54 Xml::Element & CurOut() const { return aDestination.Out(); } 55 56 // ACCESS 57 OutputStack & Out() const { return aDestination; } 58 59 protected: 60 HtmlFactory( 61 ENV & io_rEnv, 62 Xml::Element * o_pOut = 0 ) 63 : pEnv(&io_rEnv) { if (o_pOut != 0) aDestination.Enter(*o_pOut); } 64 ~HtmlFactory() {} 65 private: 66 // DATA 67 ENV * pEnv; 68 mutable OutputStack aDestination; 69 }; 70 71 72 /** @resp 73 Base class for HTML paragraph creators, which are to be put into 74 a parent HTML element. 75 */ 76 class HtmlMaker 77 { 78 public: 79 80 // INQUIRY 81 Xml::Element & CurOut() const { return *pOut; } 82 83 protected: 84 HtmlMaker( 85 Xml::Element & o_rOut ) 86 : pOut(&o_rOut) {} 87 private: 88 // DATA 89 Xml::Element * pOut; 90 }; 91 92 93 94 95 // IMPLEMENTATION 96 97 98 99 100 #endif 101 102 103