Kaydet (Commit) 2716dc0d authored tarafından Luboš Luňák's avatar Luboš Luňák

export placeholder (RES_JUMPEDITFLD) to .docx (part of bnc#779630)

Change-Id: Idbf2b1e04eebab703ba3e6c3fac8e50829833c70
üst 16b44693
...@@ -568,6 +568,7 @@ protected: ...@@ -568,6 +568,7 @@ protected:
virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd ) = 0; virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd ) = 0;
virtual void PostitField( const SwField* pFld ) = 0; virtual void PostitField( const SwField* pFld ) = 0;
virtual bool DropdownField( const SwField* pFld ) = 0; virtual bool DropdownField( const SwField* pFld ) = 0;
virtual bool PlaceholderField( const SwField* pFld ) = 0;
virtual bool AnalyzeURL( const String& rUrl, const String& rTarget, String* pLinkURL, String* pMark ); virtual bool AnalyzeURL( const String& rUrl, const String& rTarget, String* pLinkURL, String* pMark );
......
...@@ -622,6 +622,7 @@ void DocxAttributeOutput::EndRun() ...@@ -622,6 +622,7 @@ void DocxAttributeOutput::EndRun()
m_pSerializer->endElementNS( XML_w, XML_r ); m_pSerializer->endElementNS( XML_w, XML_r );
WritePostponedMath(); WritePostponedMath();
WritePendingPlaceholder();
if ( m_closeHyperlinkInThisRun ) if ( m_closeHyperlinkInThisRun )
{ {
...@@ -3781,6 +3782,36 @@ bool DocxAttributeOutput::DropdownField( const SwField* pFld ) ...@@ -3781,6 +3782,36 @@ bool DocxAttributeOutput::DropdownField( const SwField* pFld )
return bExpand; return bExpand;
} }
bool DocxAttributeOutput::PlaceholderField( const SwField* pFld )
{
assert( pendingPlaceholder == NULL );
pendingPlaceholder = pFld;
return false; // do not expand
}
void DocxAttributeOutput::WritePendingPlaceholder()
{
if( pendingPlaceholder == NULL )
return;
const SwField* pFld = pendingPlaceholder;
pendingPlaceholder = NULL;
m_pSerializer->startElementNS( XML_w, XML_sdt, FSEND );
m_pSerializer->startElementNS( XML_w, XML_sdtPr, FSEND );
if( !pFld->GetPar2().isEmpty())
m_pSerializer->singleElementNS( XML_w, XML_alias,
FSNS( XML_w, XML_val ), OUStringToOString( pFld->GetPar2(), RTL_TEXTENCODING_UTF8 ), FSEND );
m_pSerializer->singleElementNS( XML_w, XML_temporary, FSEND );
m_pSerializer->singleElementNS( XML_w, XML_showingPlcHdr, FSEND );
m_pSerializer->singleElementNS( XML_w, XML_text, FSEND );
m_pSerializer->endElementNS( XML_w, XML_sdtPr );
m_pSerializer->startElementNS( XML_w, XML_sdtContent, FSEND );
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
RunText( pFld->GetPar1());
m_pSerializer->endElementNS( XML_w, XML_r );
m_pSerializer->endElementNS( XML_w, XML_sdtContent );
m_pSerializer->endElementNS( XML_w, XML_sdt );
}
void DocxAttributeOutput::SetField( const SwField& rFld, ww::eField eType, const String& rCmd ) void DocxAttributeOutput::SetField( const SwField& rFld, ww::eField eType, const String& rCmd )
{ {
// field bookmarks are handled in the EndRun method // field bookmarks are handled in the EndRun method
...@@ -4834,6 +4865,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri ...@@ -4834,6 +4865,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_startedHyperlink( false ), m_startedHyperlink( false ),
m_postponedGraphic( NULL ), m_postponedGraphic( NULL ),
m_postponedMath( NULL ), m_postponedMath( NULL ),
pendingPlaceholder( NULL ),
m_postitFieldsMaxId( 0 ), m_postitFieldsMaxId( 0 ),
m_anchorId( 0 ), m_anchorId( 0 ),
m_nextFontId( 1 ), m_nextFontId( 1 ),
......
...@@ -326,6 +326,7 @@ private: ...@@ -326,6 +326,7 @@ private:
void FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t pInner, bool bForceEmptyParagraph = false ); void FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t pInner, bool bForceEmptyParagraph = false );
void WriteFFData( const FieldInfos& rInfos ); void WriteFFData( const FieldInfos& rInfos );
void WritePendingPlaceholder();
void EmbedFontStyle( const OUString& name, int tag, FontFamily family, FontItalic italic, FontWeight weight, void EmbedFontStyle( const OUString& name, int tag, FontFamily family, FontItalic italic, FontWeight weight,
FontPitch pitch, rtl_TextEncoding encoding ); FontPitch pitch, rtl_TextEncoding encoding );
...@@ -532,6 +533,7 @@ protected: ...@@ -532,6 +533,7 @@ protected:
virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd ); virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd );
virtual void PostitField( const SwField* pFld ); virtual void PostitField( const SwField* pFld );
virtual bool DropdownField( const SwField* pFld ); virtual bool DropdownField( const SwField* pFld );
virtual bool PlaceholderField( const SwField* pFld );
virtual bool AnalyzeURL( const String& rURL, const String& rTarget, String* pLinkURL, String* pMark ); virtual bool AnalyzeURL( const String& rURL, const String& rTarget, String* pLinkURL, String* pMark );
...@@ -627,6 +629,7 @@ private: ...@@ -627,6 +629,7 @@ private:
}; };
std::list< PostponedGraphic >* m_postponedGraphic; std::list< PostponedGraphic >* m_postponedGraphic;
const SwOLENode* m_postponedMath; const SwOLENode* m_postponedMath;
const SwField* pendingPlaceholder;
std::vector< const SwPostItField* > m_postitFields; std::vector< const SwPostItField* > m_postitFields;
unsigned int m_postitFieldsMaxId; unsigned int m_postitFieldsMaxId;
int m_anchorId; int m_anchorId;
......
...@@ -3074,6 +3074,11 @@ bool RtfAttributeOutput::DropdownField( const SwField* /*pFld*/ ) ...@@ -3074,6 +3074,11 @@ bool RtfAttributeOutput::DropdownField( const SwField* /*pFld*/ )
return true; return true;
} }
bool RtfAttributeOutput::PlaceholderField( const SwField* )
{
return true; // expand to text?
}
RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport ) RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport )
: m_rExport( rExport ), : m_rExport( rExport ),
m_bStrikeDouble( false ), m_bStrikeDouble( false ),
......
...@@ -407,6 +407,7 @@ protected: ...@@ -407,6 +407,7 @@ protected:
virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd ); virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd );
virtual void PostitField( const SwField* pFld ); virtual void PostitField( const SwField* pFld );
virtual bool DropdownField( const SwField* pFld ); virtual bool DropdownField( const SwField* pFld );
virtual bool PlaceholderField( const SwField* pFld );
/// Reference to the export, where to get the data from /// Reference to the export, where to get the data from
RtfExport &m_rExport; RtfExport &m_rExport;
......
...@@ -2473,6 +2473,11 @@ bool WW8AttributeOutput::DropdownField( const SwField* pFld ) ...@@ -2473,6 +2473,11 @@ bool WW8AttributeOutput::DropdownField( const SwField* pFld )
return bExpand; return bExpand;
} }
bool WW8AttributeOutput::PlaceholderField( const SwField* )
{
return true; // expand to text?
}
void WW8AttributeOutput::RefField( const SwField &rFld, const String &rRef) void WW8AttributeOutput::RefField( const SwField &rFld, const String &rRef)
{ {
String sStr( FieldString( ww::eREF ) ); String sStr( FieldString( ww::eREF ) );
...@@ -2922,7 +2927,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) ...@@ -2922,7 +2927,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField )
} }
} }
break; break;
case RES_HIDDENTXTFLD: case RES_HIDDENTXTFLD:
{ {
String sExpand(pFld->GetPar2()); String sExpand(pFld->GetPar2());
if (sExpand.Len()) if (sExpand.Len())
...@@ -2931,6 +2936,9 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) ...@@ -2931,6 +2936,9 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField )
} }
} }
break; break;
case RES_JUMPEDITFLD:
bWriteExpand = PlaceholderField( pFld );
break;
default: default:
bWriteExpand = true; bWriteExpand = true;
break; break;
......
...@@ -391,6 +391,7 @@ protected: ...@@ -391,6 +391,7 @@ protected:
virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd ); virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd );
virtual void PostitField( const SwField* pFld ); virtual void PostitField( const SwField* pFld );
virtual bool DropdownField( const SwField* pFld ); virtual bool DropdownField( const SwField* pFld );
virtual bool PlaceholderField( const SwField* pFld );
virtual bool AnalyzeURL( const String& rURL, const String& rTarget, String* pLinkURL, String* pMark ); virtual bool AnalyzeURL( const String& rURL, const String& rTarget, String* pLinkURL, String* pMark );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment