LCOV - code coverage report
Current view: top level - sw/source/filter/html - htmlforw.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 46 781 5.9 %
Date: 2014-04-11 Functions: 3 15 20.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/frame/XModel.hpp>
      21             : #include <com/sun/star/form/FormSubmitEncoding.hpp>
      22             : #include <com/sun/star/form/FormSubmitMethod.hpp>
      23             : #include <com/sun/star/form/FormButtonType.hpp>
      24             : #include <com/sun/star/script/XEventAttacher.hpp>
      25             : #include <com/sun/star/script/XEventAttacherManager.hpp>
      26             : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
      27             : #include <com/sun/star/form/XFormsSupplier.hpp>
      28             : #include <com/sun/star/form/XForm.hpp>
      29             : #include <com/sun/star/form/FormComponentType.hpp>
      30             : #include <com/sun/star/awt/XTextLayoutConstrains.hpp>
      31             : #include <comphelper/string.hxx>
      32             : #include <hintids.hxx>
      33             : #include <vcl/svapp.hxx>
      34             : #include <vcl/wrkwin.hxx>
      35             : #include <svl/macitem.hxx>
      36             : #include <svtools/htmlout.hxx>
      37             : #include <svtools/htmltokn.h>
      38             : #include <svtools/htmlkywd.hxx>
      39             : #include <svl/urihelper.hxx>
      40             : #include <toolkit/helper/vclunohelper.hxx>
      41             : #include <svx/svdouno.hxx>
      42             : #include <svx/fmglob.hxx>
      43             : #include <editeng/brushitem.hxx>
      44             : #include <editeng/colritem.hxx>
      45             : #include <editeng/fhgtitem.hxx>
      46             : #include <editeng/fontitem.hxx>
      47             : #include <editeng/wghtitem.hxx>
      48             : #include <editeng/postitem.hxx>
      49             : #include <editeng/udlnitem.hxx>
      50             : #include <editeng/crossedoutitem.hxx>
      51             : #include <docsh.hxx>
      52             : #include <fmtanchr.hxx>
      53             : #include <docary.hxx>
      54             : #include <viewsh.hxx>
      55             : #include "pam.hxx"
      56             : #include "doc.hxx"
      57             : #include "ndtxt.hxx"
      58             : #include "flypos.hxx"
      59             : #include "wrthtml.hxx"
      60             : #include "htmlfly.hxx"
      61             : #include "htmlform.hxx"
      62             : #include "frmfmt.hxx"
      63             : #include <rtl/strbuf.hxx>
      64             : 
      65             : using namespace ::com::sun::star;
      66             : 
      67             : const sal_uInt32 HTML_FRMOPTS_CONTROL   =
      68             :     0;
      69             : const sal_uInt32 HTML_FRMOPTS_CONTROL_CSS1  =
      70             :     HTML_FRMOPT_S_ALIGN |
      71             :     HTML_FRMOPT_S_SIZE |
      72             :     HTML_FRMOPT_S_SPACE |
      73             :     HTML_FRMOPT_BRCLEAR;
      74             : const sal_uInt32 HTML_FRMOPTS_IMG_CONTROL   =
      75             :     HTML_FRMOPT_ALIGN |
      76             :     HTML_FRMOPT_BRCLEAR;
      77             : const sal_uInt32 HTML_FRMOPTS_IMG_CONTROL_CSS1 =
      78             :     HTML_FRMOPT_S_ALIGN |
      79             :     HTML_FRMOPT_S_SPACE;
      80             : 
      81           0 : static void lcl_html_outEvents( SvStream& rStrm,
      82             :                          const uno::Reference< form::XFormComponent > rFormComp,
      83             :                          sal_Bool bCfgStarBasic,
      84             :                          rtl_TextEncoding eDestEnc,
      85             :                          OUString *pNonConvertableChars )
      86             : {
      87           0 :     uno::Reference< container::XChild > xChild( rFormComp, uno::UNO_QUERY );
      88           0 :     uno::Reference< uno::XInterface > xParentIfc = xChild->getParent();
      89             :     OSL_ENSURE( xParentIfc.is(), "lcl_html_outEvents: no parent interface" );
      90           0 :     if( !xParentIfc.is() )
      91           0 :         return;
      92           0 :     uno::Reference< container::XIndexAccess > xIndexAcc( xParentIfc, uno::UNO_QUERY );
      93             :     uno::Reference< script::XEventAttacherManager > xEventManager( xParentIfc,
      94           0 :                                                               uno::UNO_QUERY );
      95           0 :     if( !xIndexAcc.is() || !xEventManager.is() )
      96           0 :         return;
      97             : 
      98             :     // Und die Position des ControlModel darin suchen
      99           0 :     sal_Int32 nCount = xIndexAcc->getCount(), nPos;
     100           0 :     for( nPos = 0 ; nPos < nCount; nPos++ )
     101             :     {
     102           0 :         uno::Any aTmp = xIndexAcc->getByIndex(nPos);
     103             :         OSL_ENSURE( aTmp.getValueType() ==
     104             :                         ::getCppuType( (uno::Reference<form::XFormComponent>*)0 ) ||
     105             :                 aTmp.getValueType() ==
     106             :                         ::getCppuType( (uno::Reference<form::XForm>*)0 ),
     107             :                 "lcl_html_outEvents: falsche Reflection" );
     108           0 :         if( aTmp.getValueType() ==
     109           0 :                     ::getCppuType( (uno::Reference< form::XFormComponent >*)0) )
     110             : 
     111             :         {
     112           0 :             if( rFormComp ==
     113           0 :                     *(uno::Reference< form::XFormComponent > *)aTmp.getValue() )
     114           0 :                 break;
     115             :         }
     116           0 :         else if( aTmp.getValueType() ==
     117           0 :                             ::getCppuType( (uno::Reference< form::XForm>*)0) )
     118             :         {
     119             :             uno::Reference< form::XFormComponent > xFC(
     120           0 :                 *(uno::Reference< form::XForm > *)aTmp.getValue(), uno::UNO_QUERY );
     121           0 :             if( rFormComp == xFC )
     122           0 :                 break;
     123             :         }
     124           0 :     }
     125             : 
     126           0 :     if( nPos == nCount )
     127           0 :         return;
     128             : 
     129             :     uno::Sequence< script::ScriptEventDescriptor > aDescs =
     130           0 :             xEventManager->getScriptEvents( nPos );
     131           0 :     nCount = aDescs.getLength();
     132           0 :     if( !nCount )
     133           0 :         return;
     134             : 
     135           0 :     const script::ScriptEventDescriptor *pDescs = aDescs.getConstArray();
     136           0 :     for( sal_Int32 i = 0; i < nCount; i++ )
     137             :     {
     138           0 :         ScriptType eScriptType = EXTENDED_STYPE;
     139           0 :         OUString aScriptType( pDescs[i].ScriptType );
     140           0 :         if( aScriptType.equalsIgnoreAsciiCase(SVX_MACRO_LANGUAGE_JAVASCRIPT) )
     141           0 :             eScriptType = JAVASCRIPT;
     142           0 :         else if( aScriptType.equalsIgnoreAsciiCase(SVX_MACRO_LANGUAGE_STARBASIC ) )
     143           0 :             eScriptType = STARBASIC;
     144           0 :         if( JAVASCRIPT != eScriptType && !bCfgStarBasic )
     145           0 :             continue;
     146             : 
     147           0 :         OUString sListener( pDescs[i].ListenerType );
     148           0 :         sal_Int32 nTok = comphelper::string::getTokenCount(sListener, '.');
     149           0 :         if( nTok )
     150           0 :             sListener = sListener.getToken( nTok-1, '.' );
     151           0 :         OUString sMethod( pDescs[i].EventMethod );
     152             : 
     153           0 :         const sal_Char *pOpt = 0;
     154           0 :         for( sal_uInt16 j=0; aEventListenerTable[j]; j++ )
     155             :         {
     156           0 :             if( sListener.equalsAscii( aEventListenerTable[j] ) &&
     157           0 :                 sMethod.equalsAscii( aEventMethodTable[j] ) )
     158             :             {
     159             :                 pOpt = (STARBASIC==eScriptType ? aEventSDOptionTable
     160           0 :                                                : aEventOptionTable)[j];
     161           0 :                 break;
     162             :             }
     163             :         }
     164             : 
     165           0 :         OStringBuffer sOut;
     166           0 :         sOut.append(' ');
     167           0 :         if( pOpt && (EXTENDED_STYPE != eScriptType ||
     168           0 :                      pDescs[i].AddListenerParam.isEmpty()) )
     169           0 :             sOut.append(pOpt);
     170             :         else
     171             :         {
     172           0 :             sOut.append(OOO_STRING_SVTOOLS_HTML_O_sdevent)
     173             :                 .append(OUStringToOString(sListener,
     174           0 :                     RTL_TEXTENCODING_ASCII_US))
     175           0 :                 .append('-')
     176             :                 .append(OUStringToOString(sMethod,
     177           0 :                     RTL_TEXTENCODING_ASCII_US));
     178             :         }
     179           0 :         sOut.append("=\"");
     180           0 :         rStrm.WriteCharPtr( sOut.makeStringAndClear().getStr() );
     181           0 :         HTMLOutFuncs::Out_String( rStrm, pDescs[i].ScriptCode, eDestEnc, pNonConvertableChars );
     182           0 :         rStrm.WriteChar( '\"' );
     183           0 :         if( EXTENDED_STYPE == eScriptType &&
     184           0 :             !pDescs[i].AddListenerParam.isEmpty() )
     185             :         {
     186           0 :             sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdaddparam)
     187             :                 .append(OUStringToOString(sListener,
     188           0 :                     RTL_TEXTENCODING_ASCII_US))
     189           0 :                 .append('-')
     190             :                 .append(OUStringToOString(sMethod,
     191           0 :                     RTL_TEXTENCODING_ASCII_US))
     192           0 :                 .append("=\"");
     193           0 :             rStrm.WriteCharPtr( sOut.makeStringAndClear().getStr() );
     194           0 :             HTMLOutFuncs::Out_String( rStrm, pDescs[i].AddListenerParam,
     195           0 :                                       eDestEnc, pNonConvertableChars );
     196           0 :             rStrm.WriteChar( '\"' );
     197             :         }
     198           0 :     }
     199             : }
     200             : 
     201           0 : static sal_Bool lcl_html_isHTMLControl( sal_Int16 nClassId )
     202             : {
     203           0 :     sal_Bool bRet = sal_False;
     204             : 
     205           0 :     switch( nClassId )
     206             :     {
     207             :     case form::FormComponentType::TEXTFIELD:
     208             :     case form::FormComponentType::COMMANDBUTTON:
     209             :     case form::FormComponentType::RADIOBUTTON:
     210             :     case form::FormComponentType::CHECKBOX:
     211             :     case form::FormComponentType::LISTBOX:
     212             :     case form::FormComponentType::IMAGEBUTTON:
     213             :     case form::FormComponentType::FILECONTROL:
     214           0 :         bRet = sal_True;
     215           0 :         break;
     216             :     }
     217             : 
     218           0 :     return bRet;
     219             : }
     220             : 
     221           0 : sal_Bool SwHTMLWriter::HasControls() const
     222             : {
     223           0 :     sal_uInt32 nStartIdx = pCurPam->GetPoint()->nNode.GetIndex();
     224             :     sal_uInt16 i;
     225             : 
     226             :     // Skip all controls in front of the current paragraph
     227           0 :     for( i = 0; i < aHTMLControls.size() &&
     228           0 :         aHTMLControls[i]->nNdIdx < nStartIdx; i++ )
     229             :         ;
     230             : 
     231           0 :     return i < aHTMLControls.size() && aHTMLControls[i]->nNdIdx == nStartIdx;
     232             : }
     233             : 
     234         533 : void SwHTMLWriter::OutForm( sal_Bool bTag_On, const SwStartNode *pStartNd )
     235             : {
     236         533 :     if( bPreserveForm )     // wir sind in einer Tabelle oder einem Bereich
     237         266 :         return;             // ueber dem eine Form aufgespannt wurde
     238             : 
     239         533 :     if( !bTag_On )
     240             :     {
     241             :         // die Form beenden wenn alle Controls ausgegeben wurden
     242         266 :         if( pxFormComps && pxFormComps->is() &&
     243           0 :             (*pxFormComps)->getCount() == nFormCntrlCnt )
     244             :         {
     245           0 :             OutForm( sal_False, *pxFormComps );
     246           0 :             (*pxFormComps) = 0;
     247             :         }
     248         266 :         return;
     249             :     }
     250             : 
     251         267 :     uno::Reference< container::XIndexContainer > xNewFormComps;  // die neue Form
     252           1 :     sal_uInt32 nStartIdx = pStartNd ? pStartNd->GetIndex()
     253         268 :                                     : pCurPam->GetPoint()->nNode.GetIndex();
     254             : 
     255             :     // Ueberspringen von Controls vor dem interesanten Bereich
     256             :     sal_uInt16 i;
     257         267 :     for( i = 0; i < aHTMLControls.size() &&
     258           0 :         aHTMLControls[i]->nNdIdx < nStartIdx; i++ )
     259             :         ;
     260             : 
     261         267 :     if( !pStartNd )
     262             :     {
     263             :         // Check fuer einen einzelnen Node: da ist nur interessant, ob
     264             :         // es zu dem Node ein Control gibt und zu welcher Form es gehoert
     265         266 :         if( i < aHTMLControls.size() &&
     266           0 :             aHTMLControls[i]->nNdIdx == nStartIdx )
     267           0 :             xNewFormComps = aHTMLControls[i]->xFormComps;
     268             :     }
     269             :     else
     270             :     {
     271             :         // wir klappern eine Tabelle/einen Bereich ab: hier interessiert uns:
     272             :         // - ob es Controls mit unterschiedlichen Start-Nodes gibt
     273             :         // - ob es eine Form gibt, fuer die nicht alle Controls in der
     274             :         //   Tabelle/dem Bereich liegen
     275             : 
     276           1 :         uno::Reference< container::XIndexContainer > xCurrentFormComps;// die aktuelle Form in der Tabelle
     277           1 :         const SwStartNode *pCurrentStNd = 0; // und der Start-Node eines Ctrls
     278           1 :         sal_Int32 nCurrentCtrls = 0;   // und die in ihr gefundenen Controls
     279           1 :         sal_uInt32 nEndIdx =  pStartNd->EndOfSectionIndex();
     280           1 :         for( ; i < aHTMLControls.size() &&
     281           0 :             aHTMLControls[i]->nNdIdx <= nEndIdx; i++ )
     282             :         {
     283             :             const SwStartNode *pCntrlStNd =
     284           0 :                 pDoc->GetNodes()[aHTMLControls[i]->nNdIdx]->StartOfSectionNode();
     285             : 
     286           0 :             if( xCurrentFormComps.is() )
     287             :             {
     288             :                 // Wir befinden uns bereits in einer Form ...
     289           0 :                 if( xCurrentFormComps==aHTMLControls[i]->xFormComps )
     290             :                 {
     291             :                     // ... und das Control befindet sich auch darin ...
     292           0 :                     if( pCurrentStNd!=pCntrlStNd )
     293             :                     {
     294             :                         // ... aber es liegt in einer anderen Zelle:
     295             :                         // Dann muessen eir eine Form ueber der Tabelle
     296             :                         // aufmachen
     297           0 :                         xNewFormComps = xCurrentFormComps;
     298           0 :                         break;
     299             :                     }
     300           0 :                     nCurrentCtrls = nCurrentCtrls + aHTMLControls[i]->nCount;
     301             :                 }
     302             :                 else
     303             :                 {
     304             :                     // ... aber das Control liegt in einer anderen Zelle:
     305             :                     // Da tun wir so, als ob wir eine neue Form aufmachen
     306             :                     // und suchen weiter.
     307           0 :                     xCurrentFormComps = aHTMLControls[i]->xFormComps;
     308           0 :                     pCurrentStNd = pCntrlStNd;
     309           0 :                     nCurrentCtrls = aHTMLControls[i]->nCount;
     310             :                 }
     311             :             }
     312             :             else
     313             :             {
     314             :                 // Wir befinden uns noch in keiner Form:
     315             :                 // Da tun wir mal so, als ob wie wir die Form aufmachen.
     316           0 :                 xCurrentFormComps = aHTMLControls[i]->xFormComps;
     317           0 :                 pCurrentStNd = pCntrlStNd;
     318           0 :                 nCurrentCtrls = aHTMLControls[i]->nCount;
     319             :             }
     320             :         }
     321           1 :         if( !xNewFormComps.is() && xCurrentFormComps.is() &&
     322           0 :             nCurrentCtrls != xCurrentFormComps->getCount() )
     323             :         {
     324             :             // In der Tablle/dem Bereich sollte eine Form aufgemacht werden,
     325             :             // die nicht vollstaendig in der Tabelle liegt. Dan muessen
     326             :             // wie die Form jetzt ebenfalls oeffen.
     327           0 :             xNewFormComps = xCurrentFormComps;
     328           1 :         }
     329             :     }
     330             : 
     331         267 :     if( xNewFormComps.is() &&
     332           0 :         (!pxFormComps || !(xNewFormComps == *pxFormComps)) )
     333             :     {
     334             :         // Es soll eine Form aufgemacht werden ...
     335           0 :         if( pxFormComps && pxFormComps->is() )
     336             :         {
     337             :             // .. es ist aber noch eine Form offen: Das ist in
     338             :             // jedem Fall eine Fehler, aber wir schliessen die alte
     339             :             // Form trotzdem
     340           0 :             OutForm( sal_False, *pxFormComps );
     341             : 
     342             :             //!!!nWarn = 1; // Control wird falscher Form zugeordnet
     343             :         }
     344             : 
     345           0 :         if( !pxFormComps )
     346           0 :             pxFormComps = new uno::Reference< container::XIndexContainer > ;
     347           0 :         *pxFormComps = xNewFormComps;
     348             : 
     349           0 :         OutForm( sal_True, *pxFormComps );
     350           0 :         uno::Reference< beans::XPropertySet >  xTmp;
     351           0 :         OutHiddenControls( *pxFormComps, xTmp );
     352         267 :     }
     353             : }
     354             : 
     355           5 : void SwHTMLWriter::OutHiddenForms()
     356             : {
     357             :     // Ohne DrawModel kann es auch keine Controls geben. Dann darf man
     358             :     // auch nicht per UNO auf das Dok zugreifen, weil sonst ein DrawModel
     359             :     // angelegt wird.
     360           5 :     if( !pDoc->GetDrawModel() )
     361           0 :         return;
     362             : 
     363           5 :     SwDocShell *pDocSh = pDoc->GetDocShell();
     364           5 :     if( !pDocSh )
     365           0 :         return;
     366             : 
     367             :     uno::Reference< drawing::XDrawPageSupplier > xDPSupp( pDocSh->GetBaseModel(),
     368           5 :                                                      uno::UNO_QUERY );
     369             :     OSL_ENSURE( xDPSupp.is(), "XTextDocument nicht vom XModel erhalten" );
     370          10 :     uno::Reference< drawing::XDrawPage > xDrawPage = xDPSupp->getDrawPage();
     371             : 
     372             :     OSL_ENSURE( xDrawPage.is(), "XDrawPage nicht erhalten" );
     373           5 :     if( !xDrawPage.is() )
     374           0 :         return;
     375             : 
     376          10 :     uno::Reference< form::XFormsSupplier > xFormsSupplier( xDrawPage, uno::UNO_QUERY );
     377             :     OSL_ENSURE( xFormsSupplier.is(),
     378             :             "XFormsSupplier nicht vom XDrawPage erhalten" );
     379             : 
     380          10 :     uno::Reference< container::XNameContainer > xTmp = xFormsSupplier->getForms();
     381             :     OSL_ENSURE( xTmp.is(), "XForms nicht erhalten" );
     382          10 :     uno::Reference< container::XIndexContainer > xForms( xTmp, uno::UNO_QUERY );
     383             :     OSL_ENSURE( xForms.is(), "XForms ohne container::XIndexContainer?" );
     384             : 
     385           5 :     sal_Int32 nCount = xForms->getCount();
     386           5 :     for( sal_Int32 i=0; i<nCount; i++)
     387             :     {
     388           0 :         uno::Any aTmp = xForms->getByIndex( i );
     389             :         OSL_ENSURE( aTmp.getValueType() ==
     390             :                         ::getCppuType((uno::Reference< form::XForm >*)0),
     391             :                 "OutHiddenForms: falsche Reflection" );
     392           0 :         if( aTmp.getValueType() ==
     393           0 :                     ::getCppuType((uno::Reference< form::XForm >*)0) )
     394           0 :             OutHiddenForm( *(uno::Reference< form::XForm > *)aTmp.getValue() );
     395           5 :     }
     396             : }
     397             : 
     398           0 : void SwHTMLWriter::OutHiddenForm( const uno::Reference< form::XForm > & rForm )
     399             : {
     400           0 :     uno::Reference< container::XIndexContainer > xFormComps( rForm, uno::UNO_QUERY );
     401           0 :     if( !xFormComps.is() )
     402           0 :         return;
     403             : 
     404           0 :     sal_Int32 nCount = xFormComps->getCount();
     405           0 :     sal_Bool bHiddenOnly = nCount > 0, bHidden = sal_False;
     406           0 :     for( sal_Int32 i=0; i<nCount; i++ )
     407             :     {
     408           0 :         uno::Any aTmp = xFormComps->getByIndex( i );
     409             :         OSL_ENSURE( aTmp.getValueType() ==
     410             :                         ::getCppuType((uno::Reference<form::XFormComponent>*)0),
     411             :                 "OutHiddenForm: falsche Reflection" );
     412           0 :         if( aTmp.getValueType() !=
     413           0 :                     ::getCppuType((uno::Reference<form::XFormComponent>*)0) )
     414           0 :             continue;
     415             : 
     416             :         uno::Reference< form::XFormComponent > xFormComp =
     417           0 :             *(uno::Reference< form::XFormComponent > *)aTmp.getValue();
     418           0 :         uno::Reference< form::XForm > xForm( xFormComp, uno::UNO_QUERY );
     419           0 :         if( xForm.is() )
     420           0 :             OutHiddenForm( xForm );
     421             : 
     422           0 :         if( bHiddenOnly )
     423             :         {
     424           0 :             uno::Reference< beans::XPropertySet >  xPropSet( xFormComp, uno::UNO_QUERY );
     425           0 :             OUString sPropName("ClassId");
     426           0 :             if( xPropSet->getPropertySetInfo()->hasPropertyByName( sPropName ) )
     427             :             {
     428           0 :                 uno::Any aAny2 = xPropSet->getPropertyValue( sPropName );
     429           0 :                 if( aAny2.getValueType() == ::getCppuType((sal_Int16*)0) )
     430             :                 {
     431           0 :                     if( form::FormComponentType::HIDDENCONTROL ==
     432           0 :                                                 *(sal_Int16*)aAny2.getValue() )
     433           0 :                         bHidden = sal_True;
     434           0 :                     else if( lcl_html_isHTMLControl(
     435           0 :                                             *(sal_Int16*)aAny2.getValue() ) )
     436           0 :                         bHiddenOnly = sal_False;
     437           0 :                 }
     438           0 :             }
     439             :         }
     440           0 :     }
     441             : 
     442           0 :     if( bHidden && bHiddenOnly )
     443             :     {
     444           0 :         OutForm( sal_True, xFormComps );
     445           0 :         uno::Reference< beans::XPropertySet > xTmp;
     446           0 :         OutHiddenControls( xFormComps, xTmp );
     447           0 :         OutForm( sal_False, xFormComps );
     448           0 :     }
     449             : }
     450             : 
     451           0 : void SwHTMLWriter::OutForm( sal_Bool bOn,
     452             :                 const uno::Reference< container::XIndexContainer > & rFormComps )
     453             : {
     454           0 :     nFormCntrlCnt = 0;
     455             : 
     456           0 :     if( !bOn )
     457             :     {
     458           0 :         DecIndentLevel(); // Inhalt der Form einruecken
     459           0 :         if( bLFPossible )
     460           0 :             OutNewLine();
     461           0 :         HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_form, false );
     462           0 :         bLFPossible = sal_True;
     463             : 
     464           0 :         return;
     465             :     }
     466             : 
     467             :     // die neue Form wird geoeffnet
     468           0 :     if( bLFPossible )
     469           0 :         OutNewLine();
     470           0 :     OStringBuffer sOut;
     471           0 :     sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_form);
     472             : 
     473           0 :     uno::Reference< beans::XPropertySet > xFormPropSet( rFormComps, uno::UNO_QUERY );
     474             : 
     475           0 :     uno::Any aTmp = xFormPropSet->getPropertyValue(
     476           0 :                                     OUString("Name") );
     477           0 :     if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
     478           0 :         !((OUString*)aTmp.getValue())->isEmpty() )
     479             :     {
     480           0 :         sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name).append("=\"");
     481           0 :         Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     482           0 :         HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(),
     483           0 :                                   eDestEnc, &aNonConvertableCharacters );
     484           0 :         sOut.append('\"');
     485             :     }
     486             : 
     487           0 :     aTmp = xFormPropSet->getPropertyValue(
     488           0 :                     OUString("TargetURL") );
     489           0 :     if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
     490           0 :         !((OUString*)aTmp.getValue())->isEmpty() )
     491             :     {
     492           0 :         sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_action).append("=\"");
     493           0 :         Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     494           0 :         OUString aURL( *(OUString*)aTmp.getValue() );
     495           0 :         aURL = URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), aURL);
     496           0 :         HTMLOutFuncs::Out_String( Strm(), aURL, eDestEnc, &aNonConvertableCharacters );
     497           0 :         sOut.append('\"');
     498             :     }
     499             : 
     500           0 :     aTmp = xFormPropSet->getPropertyValue(
     501           0 :                     OUString("SubmitMethod") );
     502           0 :     if( aTmp.getValueType() == ::getCppuType((const form::FormSubmitMethod*)0) )
     503             :     {
     504             :         form::FormSubmitMethod eMethod =
     505           0 :                 *( form::FormSubmitMethod*)aTmp.getValue();
     506           0 :         if( form::FormSubmitMethod_POST==eMethod )
     507             :         {
     508           0 :             sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_method)
     509           0 :                 .append("=\"").append(OOO_STRING_SVTOOLS_HTML_METHOD_post)
     510           0 :                 .append('\"');
     511             :         }
     512             :     }
     513           0 :     aTmp = xFormPropSet->getPropertyValue(
     514           0 :                     OUString("SubmitEncoding") );
     515           0 :     if( aTmp.getValueType()==::getCppuType((const form::FormSubmitEncoding*)0) )
     516             :     {
     517             :         form::FormSubmitEncoding eEncType =
     518           0 :                     *( form::FormSubmitEncoding*)aTmp.getValue();
     519           0 :         const sal_Char *pStr = 0;
     520           0 :         switch( eEncType )
     521             :         {
     522             :         case form::FormSubmitEncoding_MULTIPART:
     523           0 :             pStr = OOO_STRING_SVTOOLS_HTML_ET_multipart;
     524           0 :             break;
     525             :         case form::FormSubmitEncoding_TEXT:
     526           0 :             pStr = OOO_STRING_SVTOOLS_HTML_ET_text;
     527           0 :             break;
     528             :         default:
     529             :             ;
     530             :         }
     531             : 
     532           0 :         if( pStr )
     533             :         {
     534           0 :             sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_enctype)
     535           0 :                 .append("=\"").append(pStr).append('\"');
     536             :         }
     537             :     }
     538             : 
     539           0 :     aTmp = xFormPropSet->getPropertyValue(
     540           0 :                         OUString("TargetFrame") );
     541           0 :     if( aTmp.getValueType() == ::getCppuType((const OUString*)0)&&
     542           0 :         !((OUString*)aTmp.getValue())->isEmpty() )
     543             :     {
     544           0 :         sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_target).append("=\"");
     545           0 :         Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     546           0 :         HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(),
     547           0 :                                   eDestEnc, &aNonConvertableCharacters );
     548           0 :         sOut.append('\"');
     549             :     }
     550             : 
     551           0 :     Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     552           0 :     uno::Reference< form::XFormComponent > xFormComp( rFormComps, uno::UNO_QUERY );
     553           0 :     lcl_html_outEvents( Strm(), xFormComp, bCfgStarBasic, eDestEnc, &aNonConvertableCharacters );
     554           0 :     Strm().WriteChar( '>' );
     555             : 
     556           0 :     IncIndentLevel(); // Inhalt der Form einruecken
     557           0 :     bLFPossible = sal_True;
     558             : }
     559             : 
     560           0 : void SwHTMLWriter::OutHiddenControls(
     561             :         const uno::Reference< container::XIndexContainer > & rFormComps,
     562             :         const uno::Reference< beans::XPropertySet > & rPropSet )
     563             : {
     564           0 :     sal_Int32 nCount = rFormComps->getCount();
     565           0 :     sal_Int32 nPos = 0;
     566           0 :     sal_Bool bDone = sal_False;
     567           0 :     if( rPropSet.is() )
     568             :     {
     569           0 :         uno::Reference< form::XFormComponent > xFC( rPropSet, uno::UNO_QUERY );
     570           0 :         for( nPos=0; !bDone && nPos < nCount; nPos++ )
     571             :         {
     572           0 :             uno::Any aTmp = rFormComps->getByIndex( nPos );
     573             :             OSL_ENSURE( aTmp.getValueType() ==
     574             :                         ::getCppuType((uno::Reference< form::XFormComponent>*)0),
     575             :                     "OutHiddenControls: falsche Reflection" );
     576           0 :             bDone = aTmp.getValueType() ==
     577           0 :                         ::getCppuType((uno::Reference< form::XFormComponent>*)0) &&
     578           0 :                     *(uno::Reference< form::XFormComponent > *)aTmp.getValue() ==
     579           0 :                         xFC;
     580           0 :         }
     581             :     }
     582             : 
     583           0 :     for( ; nPos < nCount; nPos++ )
     584             :     {
     585           0 :         uno::Any aTmp = rFormComps->getByIndex( nPos );
     586             :         OSL_ENSURE( aTmp.getValueType() ==
     587             :                         ::getCppuType((uno::Reference< form::XFormComponent>*)0),
     588             :                 "OutHiddenControls: falsche Reflection" );
     589           0 :         if( aTmp.getValueType() !=
     590           0 :                     ::getCppuType((uno::Reference< form::XFormComponent>*)0) )
     591           0 :             continue;
     592             :         uno::Reference< form::XFormComponent > xFC =
     593           0 :                 *(uno::Reference< form::XFormComponent > *)aTmp.getValue();
     594           0 :         uno::Reference< beans::XPropertySet > xPropSet( xFC, uno::UNO_QUERY );
     595             : 
     596           0 :         OUString sPropName = "ClassId";
     597           0 :         if( !xPropSet->getPropertySetInfo()->hasPropertyByName( sPropName ) )
     598           0 :             continue;
     599             : 
     600           0 :         aTmp = xPropSet->getPropertyValue( sPropName );
     601           0 :         if( aTmp.getValueType() != ::getCppuType((const sal_Int16*)0) )
     602           0 :             continue;
     603             : 
     604           0 :         if( form::FormComponentType::HIDDENCONTROL ==
     605           0 :                                             *(sal_Int16*) aTmp.getValue() )
     606             :         {
     607           0 :             if( bLFPossible )
     608           0 :                 OutNewLine( sal_True );
     609           0 :             OStringBuffer sOut;
     610           0 :             sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_input).append(' ')
     611           0 :                 .append(OOO_STRING_SVTOOLS_HTML_O_type).append("=\"")
     612           0 :                 .append(OOO_STRING_SVTOOLS_HTML_IT_hidden).append("\"");
     613             : 
     614           0 :             aTmp = xPropSet->getPropertyValue(
     615           0 :                             OUString("Name") );
     616           0 :             if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
     617           0 :                 !((OUString*)aTmp.getValue())->isEmpty() )
     618             :             {
     619           0 :                 sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name)
     620           0 :                     .append("=\"");
     621           0 :                 Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     622           0 :                 HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(),
     623           0 :                                           eDestEnc, &aNonConvertableCharacters );
     624           0 :                 sOut.append('\"');
     625             :             }
     626           0 :             aTmp = xPropSet->getPropertyValue(
     627           0 :                             OUString("HiddenValue") );
     628           0 :             if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
     629           0 :                 !((OUString*)aTmp.getValue())->isEmpty() )
     630             :             {
     631           0 :                 sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_value)
     632           0 :                     .append("=\"");
     633           0 :                 Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     634           0 :                 HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(),
     635           0 :                                           eDestEnc, &aNonConvertableCharacters );
     636           0 :                 sOut.append('\"');
     637             :             }
     638           0 :             sOut.append('>');
     639           0 :             Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     640             : 
     641           0 :             nFormCntrlCnt++;
     642             :         }
     643           0 :         else if( lcl_html_isHTMLControl( *(sal_Int16*) aTmp.getValue() ) )
     644             :         {
     645           0 :             break;
     646             :         }
     647           0 :     }
     648           0 : }
     649             : 
     650             : // hier folgen die Ausgabe-Routinen, dadurch sind die form::Forms gebuendelt:
     651             : 
     652           0 : const SdrObject *SwHTMLWriter::GetHTMLControl( const SwDrawFrmFmt& rFmt )
     653             : {
     654             :     // es muss ein Draw-Format sein
     655             :     OSL_ENSURE( RES_DRAWFRMFMT == rFmt.Which(),
     656             :             "GetHTMLControl nuer fuer Draw-Formate erlaubt" );
     657             : 
     658             :     // Schauen, ob es ein SdrObject dafuer gibt
     659           0 :     const SdrObject *pObj = rFmt.FindSdrObject();
     660           0 :     if( !pObj || FmFormInventor != pObj->GetObjInventor() )
     661           0 :         return 0;
     662             : 
     663           0 :     SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pObj );
     664             :     uno::Reference< awt::XControlModel >  xControlModel =
     665           0 :             pFormObj->GetUnoControlModel();
     666             : 
     667             :     OSL_ENSURE( xControlModel.is(), "UNO-Control ohne Model" );
     668           0 :     if( !xControlModel.is() )
     669           0 :         return 0;
     670             : 
     671           0 :     uno::Reference< beans::XPropertySet >  xPropSet( xControlModel, uno::UNO_QUERY );
     672             : 
     673           0 :     OUString sPropName("ClassId");
     674           0 :     if( !xPropSet->getPropertySetInfo()->hasPropertyByName( sPropName ) )
     675           0 :         return 0;
     676             : 
     677           0 :     uno::Any aTmp = xPropSet->getPropertyValue( sPropName );
     678           0 :     if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0)&&
     679           0 :         lcl_html_isHTMLControl( *(sal_Int16*) aTmp.getValue() ) )
     680             :     {
     681           0 :         return pObj;
     682             :     }
     683             : 
     684           0 :     return 0;
     685             : }
     686             : 
     687           0 : static void GetControlSize( const SdrObject& rSdrObj, Size& rSz,
     688             :                             SwDoc *pDoc )
     689             : {
     690           0 :     SwViewShell *pVSh = 0;
     691           0 :     pDoc->GetEditShell( &pVSh );
     692           0 :     if( !pVSh )
     693           0 :         return;
     694             : 
     695           0 :     SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObj );
     696           0 :     uno::Reference< awt::XControl >  xControl;
     697           0 :     SdrView* pDrawView = pVSh->GetDrawView();
     698             :     OSL_ENSURE( pDrawView && pVSh->GetWin(), "no DrawView or window!" );
     699           0 :     if ( pDrawView && pVSh->GetWin() )
     700           0 :         xControl = pFormObj->GetUnoControl( *pDrawView, *pVSh->GetWin() );
     701           0 :     uno::Reference< awt::XTextLayoutConstrains > xLC( xControl, uno::UNO_QUERY );
     702             :     OSL_ENSURE( xLC.is(), "kein XTextLayoutConstrains" );
     703           0 :     if( !xLC.is() )
     704           0 :         return;
     705             : 
     706           0 :     sal_Int16 nCols=0, nLines=0;
     707           0 :     xLC->getColumnsAndLines( nCols, nLines );
     708           0 :     rSz.Width() = nCols;
     709           0 :     rSz.Height() = nLines;
     710             : }
     711             : 
     712           0 : Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt,
     713             :                                      const SwDrawFrmFmt& rFmt,
     714             :                                      const SdrObject& rSdrObject,
     715             :                                      sal_Bool bInCntnr )
     716             : {
     717           0 :     SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
     718             : 
     719           0 :     SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObject );
     720             :     uno::Reference< awt::XControlModel > xControlModel =
     721           0 :         pFormObj->GetUnoControlModel();
     722             : 
     723             :     OSL_ENSURE( xControlModel.is(), "UNO-Control ohne Model" );
     724           0 :     if( !xControlModel.is() )
     725           0 :         return rWrt;
     726             : 
     727           0 :     uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
     728             :     uno::Reference< beans::XPropertySetInfo > xPropSetInfo =
     729           0 :             xPropSet->getPropertySetInfo();
     730             : 
     731           0 :     rHTMLWrt.nFormCntrlCnt++;
     732             : 
     733             :     enum Tag { TAG_INPUT, TAG_SELECT, TAG_TEXTAREA, TAG_NONE };
     734             :     static char const * const TagNames[] = {
     735             :         OOO_STRING_SVTOOLS_HTML_input, OOO_STRING_SVTOOLS_HTML_select,
     736             :         OOO_STRING_SVTOOLS_HTML_textarea };
     737           0 :     Tag eTag = TAG_INPUT;
     738             :     enum Type {
     739             :         TYPE_TEXT, TYPE_PASSWORD, TYPE_CHECKBOX, TYPE_RADIO, TYPE_FILE,
     740             :         TYPE_SUBMIT, TYPE_IMAGE, TYPE_RESET, TYPE_BUTTON, TYPE_NONE };
     741             :     static char const * const TypeNames[] = {
     742             :         OOO_STRING_SVTOOLS_HTML_IT_text, OOO_STRING_SVTOOLS_HTML_IT_password,
     743             :         OOO_STRING_SVTOOLS_HTML_IT_checkbox, OOO_STRING_SVTOOLS_HTML_IT_radio,
     744             :         OOO_STRING_SVTOOLS_HTML_IT_file, OOO_STRING_SVTOOLS_HTML_IT_submit,
     745             :         OOO_STRING_SVTOOLS_HTML_IT_image, OOO_STRING_SVTOOLS_HTML_IT_reset,
     746             :         OOO_STRING_SVTOOLS_HTML_IT_button };
     747           0 :     Type eType = TYPE_NONE;
     748           0 :     OUString sValue;
     749           0 :     OStringBuffer sOptions;
     750           0 :     sal_Bool bEmptyValue = sal_False;
     751           0 :     uno::Any aTmp = xPropSet->getPropertyValue(
     752           0 :                     OUString("ClassId") );
     753           0 :     sal_Int16 nClassId = *(sal_Int16*) aTmp.getValue();
     754           0 :     sal_uInt32 nFrmOpts = HTML_FRMOPTS_CONTROL;
     755           0 :     switch( nClassId )
     756             :     {
     757             :     case form::FormComponentType::CHECKBOX:
     758             :     case form::FormComponentType::RADIOBUTTON:
     759             :         eType = (form::FormComponentType::CHECKBOX == nClassId
     760           0 :                     ? TYPE_CHECKBOX : TYPE_RADIO);
     761           0 :         aTmp = xPropSet->getPropertyValue(
     762           0 :                         OUString("DefaultState") );
     763           0 :         if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0) &&
     764           0 :             TRISTATE_FALSE != *(sal_Int16*) aTmp.getValue() )
     765             :         {
     766           0 :             sOptions.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_checked);
     767             :         }
     768             : 
     769           0 :         aTmp = xPropSet->getPropertyValue(
     770           0 :                         OUString("RefValue") );
     771           0 :         if( aTmp.getValueType() == ::getCppuType((const OUString*)0) )
     772             : 
     773             :         {
     774           0 :             const OUString& rVal = *(OUString*)aTmp.getValue();
     775           0 :             if( rVal.isEmpty() )
     776           0 :                 bEmptyValue = sal_True;
     777           0 :             else if( rVal.compareToAscii( OOO_STRING_SVTOOLS_HTML_on ) != 0 )
     778           0 :                 sValue = rVal;
     779             :         }
     780           0 :         break;
     781             : 
     782             :     case form::FormComponentType::COMMANDBUTTON:
     783             :         {
     784           0 :             form::FormButtonType eButtonType = form::FormButtonType_PUSH;
     785           0 :             aTmp = xPropSet->getPropertyValue(
     786           0 :                             OUString("ButtonType") );
     787           0 :             if( aTmp.getValueType() ==
     788           0 :                             ::getCppuType((const form::FormButtonType*)0) )
     789           0 :                 eButtonType = *( form::FormButtonType*)aTmp.getValue();
     790             : 
     791           0 :             switch( eButtonType )
     792             :             {
     793             :             case form::FormButtonType_RESET:
     794           0 :                 eType = TYPE_RESET;
     795           0 :                 break;
     796             :             case form::FormButtonType_SUBMIT:
     797           0 :                 eType = TYPE_SUBMIT;
     798           0 :                 break;
     799             :             case form::FormButtonType_PUSH:
     800             :             default:
     801           0 :                 eType = TYPE_BUTTON;
     802             :             }
     803             : 
     804           0 :             aTmp = xPropSet->getPropertyValue(
     805           0 :                             OUString("Label") );
     806           0 :             if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
     807           0 :                 !((OUString*)aTmp.getValue())->isEmpty() )
     808             :             {
     809           0 :                 sValue = *(OUString*)aTmp.getValue();
     810             :             }
     811             :         }
     812           0 :         break;
     813             : 
     814             :     case form::FormComponentType::LISTBOX:
     815           0 :         if( rHTMLWrt.bLFPossible )
     816           0 :             rHTMLWrt.OutNewLine( sal_True );
     817           0 :         eTag = TAG_SELECT;
     818           0 :         aTmp = xPropSet->getPropertyValue(
     819           0 :                         OUString("Dropdown") );
     820           0 :         if( aTmp.getValueType() == ::getBooleanCppuType() &&
     821           0 :             !*(sal_Bool*)aTmp.getValue() )
     822             :         {
     823           0 :             Size aSz( 0, 0 );
     824           0 :             GetControlSize( rSdrObject, aSz, rWrt.pDoc );
     825             : 
     826             :             // wieviele sind sichtbar ??
     827           0 :             if( aSz.Height() )
     828             :             {
     829           0 :                 sOptions.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_size).
     830           0 :                     append("=\"").append(static_cast<sal_Int32>(aSz.Height())).append("\"");
     831             :             }
     832             : 
     833           0 :             aTmp = xPropSet->getPropertyValue(
     834           0 :                         OUString("MultiSelection") );
     835           0 :             if( aTmp.getValueType() == ::getBooleanCppuType() &&
     836           0 :                 *(sal_Bool*)aTmp.getValue() )
     837             :             {
     838           0 :                 sOptions.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_multiple);
     839             :             }
     840             :         }
     841           0 :         break;
     842             : 
     843             :     case form::FormComponentType::TEXTFIELD:
     844             :         {
     845           0 :             Size aSz( 0, 0 );
     846           0 :             GetControlSize( rSdrObject, aSz, rWrt.pDoc );
     847             : 
     848           0 :             sal_Bool bMultiLine = sal_False;
     849           0 :             OUString sMultiLine("MultiLine");
     850           0 :             if( xPropSetInfo->hasPropertyByName( sMultiLine ) )
     851             :             {
     852           0 :                 aTmp = xPropSet->getPropertyValue( sMultiLine );
     853           0 :                 bMultiLine = aTmp.getValueType() == ::getBooleanCppuType() &&
     854           0 :                              *(sal_Bool*)aTmp.getValue();
     855             :             }
     856             : 
     857           0 :             if( bMultiLine )
     858             :             {
     859           0 :                 if( rHTMLWrt.bLFPossible )
     860           0 :                     rHTMLWrt.OutNewLine( sal_True );
     861           0 :                 eTag = TAG_TEXTAREA;
     862             : 
     863           0 :                 if( aSz.Height() )
     864             :                 {
     865           0 :                     sOptions.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_rows).
     866           0 :                         append("=\"").
     867           0 :                         append(static_cast<sal_Int32>(aSz.Height())).append("\"");
     868             :                 }
     869           0 :                 if( aSz.Width() )
     870             :                 {
     871           0 :                     sOptions.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_cols).
     872           0 :                         append("=\"").
     873           0 :                         append(static_cast<sal_Int32>(aSz.Width())).append("\"");
     874             :                 }
     875             : 
     876           0 :                 aTmp = xPropSet->getPropertyValue(
     877           0 :                                 OUString("HScroll") );
     878           0 :                 if( aTmp.getValueType() == ::getVoidCppuType() ||
     879           0 :                     (aTmp.getValueType() == ::getBooleanCppuType() &&
     880           0 :                     !*(sal_Bool*)aTmp.getValue()) )
     881             :                 {
     882           0 :                     const sal_Char *pWrapStr = 0;
     883           0 :                     aTmp = xPropSet->getPropertyValue(
     884           0 :                             OUString("HardLineBreaks") );
     885             :                     pWrapStr =
     886           0 :                         (aTmp.getValueType() == ::getBooleanCppuType() &&
     887           0 :                         *(sal_Bool*)aTmp.getValue()) ? OOO_STRING_SVTOOLS_HTML_WW_hard
     888           0 :                                                      : OOO_STRING_SVTOOLS_HTML_WW_soft;
     889           0 :                     sOptions.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_wrap).
     890           0 :                         append("=\"").append(pWrapStr).append("\"");
     891             :                 }
     892             :             }
     893             :             else
     894             :             {
     895           0 :                 eType = TYPE_TEXT;
     896           0 :                 OUString sEchoChar("EchoChar");
     897           0 :                 if( xPropSetInfo->hasPropertyByName( sEchoChar ) )
     898             :                 {
     899           0 :                     aTmp = xPropSet->getPropertyValue( sEchoChar );
     900           0 :                     if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0) &&
     901           0 :                         *(sal_Int16*)aTmp.getValue() != 0 )
     902           0 :                         eType = TYPE_PASSWORD;
     903             :                 }
     904             : 
     905           0 :                 if( aSz.Width() )
     906             :                 {
     907           0 :                     sOptions.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_size).
     908           0 :                         append("=\"").append(static_cast<sal_Int32>(aSz.Width())).append("\"");
     909             :                 }
     910             : 
     911           0 :                 aTmp = xPropSet->getPropertyValue(
     912           0 :                             OUString("MaxTextLen") );
     913           0 :                 if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0) &&
     914           0 :                     *(sal_Int16*) aTmp.getValue() != 0 )
     915             :                 {
     916           0 :                     sOptions.append(' ').
     917           0 :                         append(OOO_STRING_SVTOOLS_HTML_O_maxlength).
     918           0 :                         append("=\"").append(static_cast<sal_Int32>(
     919           0 :                                 *(sal_Int16*) aTmp.getValue())).append("\"");
     920             :                 }
     921             : 
     922           0 :                 OUString sDefaultText("DefaultText");
     923           0 :                 if( xPropSetInfo->hasPropertyByName( sDefaultText ) )
     924             :                 {
     925           0 :                     aTmp = xPropSet->getPropertyValue( sDefaultText );
     926           0 :                     if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
     927           0 :                         !((OUString*)aTmp.getValue())->isEmpty() )
     928             :                     {
     929           0 :                         sValue = *(OUString*)aTmp.getValue();
     930             :                     }
     931           0 :                 }
     932           0 :             }
     933             :         }
     934           0 :         break;
     935             : 
     936             :     case form::FormComponentType::FILECONTROL:
     937             :         {
     938           0 :             Size aSz( 0, 0 );
     939           0 :             GetControlSize( rSdrObject, aSz, rWrt.pDoc );
     940           0 :             eType = TYPE_FILE;
     941             : 
     942           0 :             if( aSz.Width() )
     943             :             {
     944           0 :                 sOptions.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_size).
     945           0 :                     append("=\"").append(static_cast<sal_Int32>(aSz.Width())).append("\"");
     946             :             }
     947             : 
     948             :             // VALUE vim form aus Sicherheitsgruenden nicht exportieren
     949             :         }
     950           0 :         break;
     951             : 
     952             :     case form::FormComponentType::IMAGEBUTTON:
     953           0 :         eType = TYPE_IMAGE;
     954           0 :         nFrmOpts = HTML_FRMOPTS_IMG_CONTROL;
     955           0 :         break;
     956             : 
     957             :     default:                // kennt HTML nicht
     958           0 :         eTag = TAG_NONE;        // also ueberspringen
     959           0 :         break;
     960             :     }
     961             : 
     962           0 :     if( eTag == TAG_NONE )
     963           0 :         return rWrt;
     964             : 
     965           0 :     OStringBuffer sOut;
     966           0 :     sOut.append('<').append(TagNames[eTag]);
     967           0 :     if( eType != TYPE_NONE )
     968             :     {
     969           0 :         sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_type).
     970           0 :             append("=\"").append(TypeNames[eType]).append("\"");
     971             :     }
     972             : 
     973           0 :     aTmp = xPropSet->getPropertyValue("Name");
     974           0 :     if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
     975           0 :         !((OUString*)aTmp.getValue())->isEmpty() )
     976             :     {
     977           0 :         sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name).
     978           0 :             append("=\"");
     979           0 :         rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     980           0 :         HTMLOutFuncs::Out_String( rWrt.Strm(), *(OUString*)aTmp.getValue(),
     981           0 :                                   rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
     982           0 :         sOut.append('\"');
     983             :     }
     984             : 
     985           0 :     aTmp = xPropSet->getPropertyValue("Enabled");
     986           0 :     if( aTmp.getValueType() == ::getBooleanCppuType() &&
     987           0 :         !*(sal_Bool*)aTmp.getValue() )
     988             :     {
     989           0 :         sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_disabled);
     990             :     }
     991             : 
     992           0 :     if( !sValue.isEmpty() || bEmptyValue )
     993             :     {
     994           0 :         sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_value).append(
     995           0 :             "=\"");
     996           0 :         rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     997           0 :         HTMLOutFuncs::Out_String( rWrt.Strm(), sValue, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
     998           0 :         sOut.append('\"');
     999             :     }
    1000             : 
    1001           0 :     sOut.append(sOptions.makeStringAndClear());
    1002             : 
    1003           0 :     if( TYPE_IMAGE == eType )
    1004             :     {
    1005           0 :         aTmp = xPropSet->getPropertyValue(
    1006           0 :                     OUString("ImageURL") );
    1007           0 :         if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
    1008           0 :             !((OUString*)aTmp.getValue())->isEmpty() )
    1009             :         {
    1010           0 :             sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_src).
    1011           0 :                 append("=\"");
    1012           0 :             rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
    1013             : 
    1014           0 :             HTMLOutFuncs::Out_String( rWrt.Strm(),
    1015           0 :                         URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), *(OUString*)aTmp.getValue()),
    1016           0 :                         rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
    1017           0 :             sOut.append('\"');
    1018             :         }
    1019             : 
    1020           0 :         Size aTwipSz( rSdrObject.GetLogicRect().GetSize() );
    1021           0 :         Size aPixelSz( 0, 0 );
    1022           0 :         if( (aTwipSz.Width() || aTwipSz.Height()) &&
    1023           0 :             Application::GetDefaultDevice() )
    1024             :         {
    1025             :             aPixelSz =
    1026             :                 Application::GetDefaultDevice()->LogicToPixel( aTwipSz,
    1027           0 :                                                     MapMode(MAP_TWIP) );
    1028           0 :             if( !aPixelSz.Width() && aTwipSz.Width() )
    1029           0 :                 aPixelSz.Width() = 1;
    1030           0 :             if( !aPixelSz.Height() && aTwipSz.Height() )
    1031           0 :                 aPixelSz.Height() = 1;
    1032             :         }
    1033             : 
    1034           0 :         if( aPixelSz.Width() )
    1035             :         {
    1036           0 :             sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).
    1037           0 :                 append("=\"").append(static_cast<sal_Int32>(aPixelSz.Width())).append("\"");
    1038             :         }
    1039             : 
    1040           0 :         if( aPixelSz.Height() )
    1041             :         {
    1042           0 :             sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height).
    1043           0 :                 append("=\"").append(static_cast<sal_Int32>(aPixelSz.Height())).append("\"");
    1044             :         }
    1045             :     }
    1046             : 
    1047           0 :     aTmp = xPropSet->getPropertyValue(
    1048           0 :                     OUString("TabIndex") );
    1049           0 :     if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0) )
    1050             :     {
    1051           0 :         sal_Int16 nTabIndex = *(sal_Int16*) aTmp.getValue();
    1052           0 :         if( nTabIndex > 0 )
    1053             :         {
    1054           0 :             if( nTabIndex >= 32767 )
    1055           0 :                 nTabIndex = 32767;
    1056             : 
    1057           0 :             sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_tabindex).
    1058           0 :                 append("=\"").append(static_cast<sal_Int32>(nTabIndex)).append("\"");
    1059             :         }
    1060             :     }
    1061             : 
    1062           0 :     if( !sOut.isEmpty() )
    1063           0 :         rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
    1064             : 
    1065             :     OSL_ENSURE( !bInCntnr, "Container wird fuer Controls nicht unterstuertzt" );
    1066           0 :     if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_DRAW ) && !bInCntnr )
    1067             :     {
    1068             :         // Wenn Zeichen-Objekte nicht absolut positioniert werden duerfen,
    1069             :         // das entsprechende Flag loeschen.
    1070             :         nFrmOpts |= (TYPE_IMAGE == eType
    1071             :                             ? HTML_FRMOPTS_IMG_CONTROL_CSS1
    1072           0 :                             : HTML_FRMOPTS_CONTROL_CSS1);
    1073             :     }
    1074           0 :     OString aEndTags;
    1075           0 :     if( nFrmOpts != 0 )
    1076           0 :         aEndTags = rHTMLWrt.OutFrmFmtOptions( rFmt, aEmptyOUStr, nFrmOpts );
    1077             : 
    1078           0 :     if( rHTMLWrt.bCfgOutStyles )
    1079             :     {
    1080           0 :         sal_Bool bEdit = TAG_TEXTAREA == eTag || TYPE_FILE == eType ||
    1081           0 :                      TYPE_TEXT == eType;
    1082             : 
    1083           0 :         SfxItemSet aItemSet( rHTMLWrt.pDoc->GetAttrPool(), RES_CHRATR_BEGIN,
    1084           0 :                              RES_CHRATR_END );
    1085           0 :         OUString sPropName("BackgroundColor");
    1086           0 :         if( xPropSetInfo->hasPropertyByName( sPropName ) )
    1087             :         {
    1088           0 :             aTmp = xPropSet->getPropertyValue( sPropName );
    1089           0 :             if( aTmp.getValueType() == ::getCppuType((const sal_Int32*)0) )
    1090             :             {
    1091           0 :                 Color aCol(*(sal_Int32*)aTmp .getValue());
    1092           0 :                 aItemSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ) );
    1093             :             }
    1094             :         }
    1095           0 :         sPropName = "TextColor";
    1096           0 :         if( xPropSetInfo->hasPropertyByName( sPropName ) )
    1097             :         {
    1098           0 :             aTmp = xPropSet->getPropertyValue( sPropName );
    1099           0 :             if( aTmp.getValueType() == ::getCppuType((const sal_Int32*)0) )
    1100             :             {
    1101           0 :                 Color aColor( *(sal_Int32*)aTmp .getValue() );
    1102           0 :                 aItemSet.Put( SvxColorItem( aColor, RES_CHRATR_COLOR ) );
    1103             :             }
    1104             :         }
    1105           0 :         sPropName = "FontHeight";
    1106           0 :         if( xPropSetInfo->hasPropertyByName( sPropName ) )
    1107             :         {
    1108           0 :             aTmp = xPropSet->getPropertyValue( sPropName );
    1109           0 :             if( aTmp.getValueType() == ::getCppuType((const float*)0) )
    1110             : 
    1111             :             {
    1112           0 :                 float nHeight = *(float*)aTmp.getValue();
    1113           0 :                 if( nHeight > 0  && (!bEdit || nHeight != 10.) )
    1114           0 :                     aItemSet.Put( SvxFontHeightItem( sal_Int16(nHeight * 20.), 100, RES_CHRATR_FONTSIZE ) );
    1115             :             }
    1116             :         }
    1117           0 :         sPropName = "FontName";
    1118           0 :         if( xPropSetInfo->hasPropertyByName( sPropName ) )
    1119             :         {
    1120           0 :             aTmp = xPropSet->getPropertyValue( sPropName );
    1121           0 :             if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
    1122           0 :                 !((OUString*)aTmp.getValue())->isEmpty() )
    1123             :             {
    1124             :                 Font aFixedFont( OutputDevice::GetDefaultFont(
    1125             :                                     DEFAULTFONT_FIXED, LANGUAGE_ENGLISH_US,
    1126           0 :                                     DEFAULTFONT_FLAGS_ONLYONE ) );
    1127           0 :                 OUString aFName( *(OUString*)aTmp.getValue() );
    1128           0 :                 if( !bEdit || aFName != aFixedFont.GetName() )
    1129             :                 {
    1130           0 :                     FontFamily eFamily = FAMILY_DONTKNOW;
    1131           0 :                     sPropName = "FontFamily";
    1132           0 :                     if( xPropSetInfo->hasPropertyByName( sPropName ) )
    1133             :                     {
    1134           0 :                         aTmp = xPropSet->getPropertyValue( sPropName );
    1135           0 :                         if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0))
    1136           0 :                             eFamily = (FontFamily)*(sal_Int16*) aTmp.getValue();
    1137             :                     }
    1138           0 :                     SvxFontItem aItem( eFamily, aFName, aEmptyOUStr, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
    1139           0 :                     aItemSet.Put( aItem );
    1140           0 :                 }
    1141             :             }
    1142             :         }
    1143           0 :         sPropName = "FontWeight";
    1144           0 :         if( xPropSetInfo->hasPropertyByName( sPropName ) )
    1145             :         {
    1146           0 :             aTmp = xPropSet->getPropertyValue( sPropName );
    1147           0 :             if( aTmp.getValueType() == ::getCppuType((const float*)0) )
    1148             :             {
    1149             :                 FontWeight eWeight =
    1150           0 :                     VCLUnoHelper::ConvertFontWeight( *(float*)aTmp.getValue() );
    1151           0 :                 if( eWeight != WEIGHT_DONTKNOW && eWeight != WEIGHT_NORMAL )
    1152           0 :                     aItemSet.Put( SvxWeightItem( eWeight, RES_CHRATR_WEIGHT ) );
    1153             :             }
    1154             :         }
    1155           0 :         sPropName = "FontSlant";
    1156           0 :         if( xPropSetInfo->hasPropertyByName( sPropName ) )
    1157             :         {
    1158           0 :             aTmp = xPropSet->getPropertyValue( sPropName );
    1159           0 :             if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0))
    1160             :             {
    1161           0 :                 FontItalic eItalic = (FontItalic)*(sal_Int16*)aTmp.getValue();
    1162           0 :                 if( eItalic != ITALIC_DONTKNOW && eItalic != ITALIC_NONE )
    1163           0 :                     aItemSet.Put( SvxPostureItem( eItalic, RES_CHRATR_POSTURE ) );
    1164             :             }
    1165             :         }
    1166           0 :         sPropName = "FontUnderline";
    1167           0 :         if( xPropSetInfo->hasPropertyByName( sPropName ) )
    1168             :         {
    1169           0 :             aTmp = xPropSet->getPropertyValue( sPropName );
    1170           0 :             if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0) )
    1171             :             {
    1172             :                 FontUnderline eUnderline =
    1173           0 :                     (FontUnderline)*(sal_Int16*)aTmp.getValue();
    1174           0 :                 if( eUnderline != UNDERLINE_DONTKNOW  &&
    1175             :                     eUnderline != UNDERLINE_NONE )
    1176           0 :                     aItemSet.Put( SvxUnderlineItem( eUnderline, RES_CHRATR_UNDERLINE ) );
    1177             :             }
    1178             :         }
    1179           0 :         sPropName = "FontStrikeout";
    1180           0 :         if( xPropSetInfo->hasPropertyByName( sPropName ) )
    1181             :         {
    1182           0 :             aTmp = xPropSet->getPropertyValue( sPropName );
    1183           0 :             if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0))
    1184             :             {
    1185             :                 FontStrikeout eStrikeout =
    1186           0 :                     (FontStrikeout)*(sal_Int16*)aTmp.getValue();
    1187           0 :                 if( eStrikeout != STRIKEOUT_DONTKNOW &&
    1188             :                     eStrikeout != STRIKEOUT_NONE )
    1189           0 :                     aItemSet.Put( SvxCrossedOutItem( eStrikeout, RES_CHRATR_CROSSEDOUT ) );
    1190             :             }
    1191             :         }
    1192             : 
    1193             :         rHTMLWrt.OutCSS1_FrmFmtOptions( rFmt, nFrmOpts, &rSdrObject,
    1194           0 :                                         &aItemSet );
    1195             :     }
    1196             : 
    1197           0 :     uno::Reference< form::XFormComponent >  xFormComp( xControlModel, uno::UNO_QUERY );
    1198           0 :     lcl_html_outEvents( rWrt.Strm(), xFormComp, rHTMLWrt.bCfgStarBasic,
    1199           0 :                         rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
    1200             : 
    1201           0 :     rWrt.Strm().WriteChar( '>' );
    1202             : 
    1203           0 :     if( TAG_SELECT == eTag )
    1204             :     {
    1205           0 :         aTmp = xPropSet->getPropertyValue(
    1206           0 :                     OUString("StringItemList") );
    1207           0 :         if( aTmp.getValueType() == ::getCppuType((uno::Sequence<OUString>*)0) )
    1208             :         {
    1209           0 :             rHTMLWrt.IncIndentLevel(); // der Inhalt von Select darf
    1210             :                                        // eingerueckt werden
    1211           0 :             uno::Sequence<OUString> aList( *(uno::Sequence<OUString>*)aTmp.getValue() );
    1212           0 :             sal_Int32 nCnt = aList.getLength();
    1213           0 :             const OUString *pStrings = aList.getConstArray();
    1214             : 
    1215           0 :             const OUString *pValues = 0;
    1216           0 :             sal_Int32 nValCnt = 0;
    1217           0 :             aTmp = xPropSet->getPropertyValue(
    1218           0 :                             OUString("ListSource") );
    1219           0 :             uno::Sequence<OUString> aValList;
    1220           0 :             if( aTmp.getValueType() == ::getCppuType((uno::Sequence<OUString>*)0) )
    1221             :             {
    1222           0 :                 aValList = *(uno::Sequence<OUString>*)aTmp.getValue();
    1223           0 :                 nValCnt = aValList.getLength();
    1224           0 :                 pValues = aValList.getConstArray();
    1225             :             }
    1226             : 
    1227           0 :             uno::Any aSelTmp = xPropSet->getPropertyValue(
    1228           0 :                             OUString("DefaultSelection") );
    1229           0 :             const sal_Int16 *pSels = 0;
    1230           0 :             sal_Int32 nSel = 0;
    1231           0 :             sal_Int32 nSelCnt = 0;
    1232           0 :             uno::Sequence<sal_Int16> aSelList;
    1233           0 :             if( aSelTmp.getValueType() ==::getCppuType((uno::Sequence<sal_Int16>*)0))
    1234             :             {
    1235           0 :                 aSelList = *(uno::Sequence<sal_Int16>*)aSelTmp.getValue();
    1236           0 :                 nSelCnt = aSelList.getLength();
    1237           0 :                 pSels = aSelList.getConstArray();
    1238             :             }
    1239             : 
    1240           0 :             for( sal_Int32 i = 0; i < nCnt; i++ )
    1241             :             {
    1242           0 :                 OUString sVal;
    1243           0 :                 sal_Bool bSelected = sal_False, bEmptyVal = sal_False;
    1244           0 :                 if( i < nValCnt )
    1245             :                 {
    1246           0 :                     const OUString& rVal = pValues[i];
    1247           0 :                     if( rVal.equalsAscii( "$$$empty$$$" ) )
    1248           0 :                         bEmptyVal = sal_True;
    1249             :                     else
    1250           0 :                         sVal = rVal;
    1251             :                 }
    1252             : 
    1253           0 :                 bSelected = (nSel < nSelCnt) && pSels[nSel] == i;
    1254           0 :                 if( bSelected )
    1255           0 :                     nSel++;
    1256             : 
    1257           0 :                 rHTMLWrt.OutNewLine(); // jede Option bekommt eine eigene Zeile
    1258           0 :                 sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_option);
    1259           0 :                 if( !sVal.isEmpty() || bEmptyVal )
    1260             :                 {
    1261           0 :                     sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_value).
    1262           0 :                         append("=\"");
    1263           0 :                     rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
    1264           0 :                     HTMLOutFuncs::Out_String( rWrt.Strm(), sVal,
    1265           0 :                         rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
    1266           0 :                     sOut.append('\"');
    1267             :                 }
    1268           0 :                 if( bSelected )
    1269           0 :                     sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_selected);
    1270             : 
    1271           0 :                 sOut.append('>');
    1272           0 :                 rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
    1273             : 
    1274           0 :                 HTMLOutFuncs::Out_String( rWrt.Strm(), pStrings[i],
    1275           0 :                                           rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
    1276           0 :             }
    1277           0 :             HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_option, false );
    1278             : 
    1279           0 :             rHTMLWrt.DecIndentLevel();
    1280           0 :             rHTMLWrt.OutNewLine();// das </SELECT> bekommt eine eigene Zeile
    1281             :         }
    1282           0 :         HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_select, false );
    1283             :     }
    1284           0 :     else if( TAG_TEXTAREA == eTag )
    1285             :     {
    1286             :         // In TextAreas duerfen keine zusaetzlichen Spaces oder LF exportiert
    1287             :         // werden!
    1288           0 :         OUString sVal;
    1289           0 :         aTmp = xPropSet->getPropertyValue(
    1290           0 :         OUString("DefaultText") );
    1291           0 :         if( aTmp.getValueType() == ::getCppuType((const OUString*)0)&&
    1292           0 :             !((OUString*)aTmp.getValue())->isEmpty() )
    1293             :         {
    1294           0 :             sVal = *(OUString*)aTmp.getValue();
    1295             :         }
    1296           0 :         if( !sVal.isEmpty() )
    1297             :         {
    1298           0 :             sVal = convertLineEnd(sVal, LINEEND_LF);
    1299           0 :             sal_Int32 nPos = 0;
    1300           0 :             while ( nPos != -1 )
    1301             :             {
    1302           0 :                 if( nPos )
    1303           0 :                     rWrt.Strm().WriteCharPtr( SAL_NEWLINE_STRING );
    1304           0 :                 OUString aLine = sVal.getToken( 0, 0x0A, nPos );
    1305           0 :                 HTMLOutFuncs::Out_String( rWrt.Strm(), aLine,
    1306           0 :                                         rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
    1307           0 :             }
    1308             :         }
    1309           0 :         HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_textarea, false );
    1310             :     }
    1311           0 :     else if( TYPE_CHECKBOX == eType || TYPE_RADIO == eType )
    1312             :     {
    1313           0 :         aTmp = xPropSet->getPropertyValue("Label");
    1314           0 :         if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
    1315           0 :             !((OUString*)aTmp.getValue())->isEmpty() )
    1316             :         {
    1317           0 :             sValue = *(OUString*)aTmp.getValue();
    1318           0 :             HTMLOutFuncs::Out_String( rWrt.Strm(), sValue,
    1319           0 :                 rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ).WriteChar( ' ' );
    1320             :         }
    1321             :     }
    1322             : 
    1323           0 :     if( !aEndTags.isEmpty() )
    1324           0 :         rWrt.Strm().WriteCharPtr( aEndTags.getStr() );
    1325             : 
    1326             :     // Controls sind nicht absatz-gebunden, deshalb kein LF mehr ausgeben!
    1327           0 :     rHTMLWrt.bLFPossible = sal_False;
    1328             : 
    1329           0 :     if( rHTMLWrt.pxFormComps && rHTMLWrt.pxFormComps->is() )
    1330           0 :         rHTMLWrt.OutHiddenControls( *rHTMLWrt.pxFormComps, xPropSet );
    1331           0 :     return rWrt;
    1332             : }
    1333             : 
    1334             : // Ermitteln, ob eine Format zu einem Control gehoert und wenn ja
    1335             : // dessen Form zurueckgeben
    1336           0 : static void AddControl( HTMLControls& rControls,
    1337             :                         const SdrObject *pSdrObj,
    1338             :                         sal_uInt32 nNodeIdx )
    1339             : {
    1340           0 :     SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pSdrObj );
    1341             :     OSL_ENSURE( pFormObj, "Doch kein FormObj" );
    1342             :     uno::Reference< awt::XControlModel > xControlModel =
    1343           0 :             pFormObj->GetUnoControlModel();
    1344           0 :     if( !xControlModel.is() )
    1345           0 :         return;
    1346             : 
    1347           0 :     uno::Reference< form::XFormComponent >  xFormComp( xControlModel, uno::UNO_QUERY );
    1348           0 :     uno::Reference< uno::XInterface >  xIfc = xFormComp->getParent();
    1349           0 :     uno::Reference< form::XForm >  xForm(xIfc, uno::UNO_QUERY);
    1350             : 
    1351             :     OSL_ENSURE( xForm.is(), "Wo ist die Form?" );
    1352           0 :     if( xForm.is() )
    1353             :     {
    1354           0 :         uno::Reference< container::XIndexContainer >  xFormComps( xForm, uno::UNO_QUERY );
    1355           0 :         HTMLControl *pHCntrl = new HTMLControl( xFormComps, nNodeIdx );
    1356           0 :         HTMLControls::const_iterator it = rControls.find( pHCntrl );
    1357           0 :         if( it == rControls.end() )
    1358           0 :             rControls.insert( pHCntrl );
    1359             :         else
    1360             :         {
    1361           0 :             if( (*it)->xFormComps==xFormComps )
    1362           0 :                 (*it)->nCount++;
    1363           0 :             delete pHCntrl;
    1364           0 :         }
    1365           0 :     }
    1366             : }
    1367             : 
    1368           5 : void SwHTMLWriter::GetControls()
    1369             : {
    1370             :     // Idee: die absatz- und zeichengebundenen Controls werden erst einmal
    1371             :     // eingesammelt. Dabei wird fuer jedes Control des Absatz-Position
    1372             :     // und VCForm in einem Array gemerkt.
    1373             :     // Ueber dieses Array laesst sich dann feststellen, wo form::Forms geoeffnet
    1374             :     // und geschlossen werden muessen.
    1375             :     sal_uInt16 i;
    1376           5 :     if( pHTMLPosFlyFrms )
    1377             :     {
    1378             :         // die absatz-gebundenen Controls einsammeln
    1379           4 :         for( i=0; i<pHTMLPosFlyFrms->size(); i++ )
    1380             :         {
    1381           2 :             const SwHTMLPosFlyFrm* pPosFlyFrm = (*pHTMLPosFlyFrms)[ i ];
    1382           2 :             if( HTML_OUT_CONTROL != pPosFlyFrm->GetOutFn() )
    1383           2 :                 continue;
    1384             : 
    1385           0 :             const SdrObject *pSdrObj = pPosFlyFrm->GetSdrObject();
    1386             :             OSL_ENSURE( pSdrObj, "Wo ist das SdrObject?" );
    1387           0 :             if( !pSdrObj )
    1388           0 :                 continue;
    1389             : 
    1390             :             AddControl( aHTMLControls, pSdrObj,
    1391           0 :                         pPosFlyFrm->GetNdIndex().GetIndex() );
    1392             :         }
    1393             :     }
    1394             : 
    1395             :     // und jetzt die in einem zeichengebundenen Rahmen
    1396           5 :     const SwFrmFmts* pSpzFrmFmts = pDoc->GetSpzFrmFmts();
    1397           7 :     for( i=0; i<pSpzFrmFmts->size(); i++ )
    1398             :     {
    1399           2 :         const SwFrmFmt *pFrmFmt = (*pSpzFrmFmts)[i];
    1400           2 :         if( RES_DRAWFRMFMT != pFrmFmt->Which() )
    1401           2 :             continue;
    1402             : 
    1403           0 :         const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
    1404           0 :         const SwPosition *pPos = rAnchor.GetCntntAnchor();
    1405           0 :         if ((FLY_AS_CHAR != rAnchor.GetAnchorId()) || !pPos)
    1406           0 :             continue;
    1407             : 
    1408             :         const SdrObject *pSdrObj =
    1409           0 :             SwHTMLWriter::GetHTMLControl( *(const SwDrawFrmFmt*)pFrmFmt );
    1410           0 :         if( !pSdrObj )
    1411           0 :             continue;
    1412             : 
    1413           0 :         AddControl( aHTMLControls, pSdrObj, pPos->nNode.GetIndex() );
    1414             :     }
    1415           5 : }
    1416             : 
    1417           0 : HTMLControl::HTMLControl(
    1418             :         const uno::Reference< container::XIndexContainer > & rFormComps,
    1419             :         sal_uInt32 nIdx ) :
    1420           0 :     xFormComps( rFormComps ), nNdIdx( nIdx ), nCount( 1 )
    1421           0 : {}
    1422             : 
    1423           0 : HTMLControl::~HTMLControl()
    1424           0 : {}
    1425             : 
    1426             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10