editeng/source/editeng/impedit2.cxx | 8 - editeng/source/misc/splwrap.cxx | 2 include/xmloff/txtparae.hxx | 11 ++ include/xmloff/xmlexp.hxx | 18 ++-- sc/source/ui/dbgui/dbnamdlg.cxx | 2 xmloff/source/core/xmlexp.cxx | 154 +++++++++++++++++++----------------- xmloff/source/text/txtimp.cxx | 3 xmloff/source/text/txtparae.cxx | 137 ++++++++++++++++++-------------- xmloff/source/text/txtparai.cxx | 100 ++++++++++++----------- 9 files changed, 244 insertions(+), 191 deletions(-)
New commits: commit 5f9d7ab963dbc1e13e4645fcef954cb8772cbb63 Author: Oliver-Rainer Wittmann <o...@apache.org> Date: Tue Jan 14 13:10:51 2014 +0000 Resolves: #i123457# suppress import and export of hyperlinks without an URL (cherry picked from commit 71d322a8ce0f5f5cbfd66fd689ff10b3490c1ee4) Conflicts: include/xmloff/xmlexp.hxx xmloff/source/core/xmlexp.cxx xmloff/source/text/txtparae.cxx xmloff/source/text/txtparai.cxx Change-Id: Ie8291c93c86815cab68482b35a5e88a3bd9b731e diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx index 585cc3f..87b32fc 100644 --- a/include/xmloff/txtparae.hxx +++ b/include/xmloff/txtparae.hxx @@ -105,6 +105,17 @@ public: enum FieldmarkType { NONE, TEXT, CHECK }; // Used for simulating fieldmarks in OpenDocument 1.n Strict (for n <= 2). CHECK currently ignored. + + void exportTextRangeSpan( + const ::com::sun::star::uno::Reference< com::sun::star::text::XTextRange > & rTextRange, + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xPropSet, + ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > & xPropSetInfo, + const sal_Bool bIsUICharStyle, + const sal_Bool bHasAutoStyle, + const OUString& sStyle, + bool& rPrevCharIsSpace, + FieldmarkType& openFieldMark); + protected: const OUString sActualSize; diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx index b734777..2e77c5c 100644 --- a/include/xmloff/xmlexp.hxx +++ b/include/xmloff/xmlexp.hxx @@ -654,14 +654,16 @@ inline void SvXMLExport::SetGraphicResolver( // Helper class to export an element. class XMLOFF_DLLPUBLIC SvXMLElementExport { - SvXMLExport& rExport; - OUString aName; - sal_Bool bIgnWS : 1; - sal_Bool bDoSomething : 1; - - SAL_DLLPRIVATE void StartElement( SvXMLExport& rExp, sal_uInt16 nPrefix, - const OUString& rName, - sal_Bool bIgnWSOutside ); + SvXMLExport& mrExport; + OUString maElementName; + const sal_Bool mbIgnoreWhitespaceInside :1; + const sal_Bool mbDoSomething :1; + + SAL_DLLPRIVATE + void StartElement( + const sal_uInt16 nPrefix, + const OUString& rName, + const sal_Bool bIgnoreWhitespaceOutside ); public: diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index cd9d54f..0c9e3dc 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -2531,83 +2531,95 @@ sal_Bool SvXMLExport::SetNullDateOnUnitConverter() return mpImpl->mbNullDateInitialized; } -void SvXMLElementExport::StartElement( SvXMLExport& rExp, - sal_uInt16 nPrefixKey, - const OUString& rLName, - sal_Bool bIWSOutside ) -{ - aName = rExp.GetNamespaceMap().GetQNameByKey(nPrefixKey, rLName); - rExp.StartElement(aName, bIWSOutside); -} - -SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp, - sal_uInt16 nPrefixKey, - const sal_Char *pLName, - sal_Bool bIWSOutside, - sal_Bool bIWSInside ) : - rExport( rExp ), - bIgnWS( bIWSInside ), - bDoSomething( sal_True ) -{ - OUString sLName( OUString::createFromAscii(pLName) ); - StartElement( rExp, nPrefixKey, sLName, bIWSOutside ); -} - -SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp, - sal_uInt16 nPrefixKey, - const OUString& rLName, - sal_Bool bIWSOutside, - sal_Bool bIWSInside ) : - rExport( rExp ), - bIgnWS( bIWSInside ), - bDoSomething( sal_True ) -{ - StartElement( rExp, nPrefixKey, rLName, bIWSOutside ); -} - -SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp, - sal_uInt16 nPrefixKey, - enum XMLTokenEnum eLName, - sal_Bool bIWSOutside, - sal_Bool bIWSInside ) : - rExport( rExp ), - bIgnWS( bIWSInside ), - bDoSomething( sal_True ) -{ - StartElement( rExp, nPrefixKey, GetXMLToken(eLName), bIWSOutside ); -} - -SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp, - sal_Bool bDoSth, - sal_uInt16 nPrefixKey, - enum XMLTokenEnum eLName, - sal_Bool bIWSOutside, - sal_Bool bIWSInside ) : - rExport( rExp ), - bIgnWS( bIWSInside ), - bDoSomething( bDoSth ) -{ - if( bDoSomething ) - StartElement( rExport, nPrefixKey, GetXMLToken(eLName), bIWSOutside ); -} - -SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp, - const OUString& rQName, - sal_Bool bIWSOutside, - sal_Bool bIWSInside ) : - rExport( rExp ), - bIgnWS( bIWSInside ), - bDoSomething( sal_True ) -{ - aName = rQName; +//============================================================================= + +void SvXMLElementExport::StartElement( + const sal_uInt16 nPrefixKey, + const OUString& rLName, + const sal_Bool bIgnoreWhitespaceOutside ) +{ + maElementName = mrExport.GetNamespaceMap().GetQNameByKey(nPrefixKey, rLName); + mrExport.StartElement(maElementName, bIgnoreWhitespaceOutside); +} + +SvXMLElementExport::SvXMLElementExport( + SvXMLExport& rExp, + sal_uInt16 nPrefixKey, + const sal_Char *pLName, + sal_Bool bIWSOutside, + sal_Bool bIWSInside ) + : mrExport( rExp ) + , maElementName() + , mbIgnoreWhitespaceInside( bIWSInside ) + , mbDoSomething( sal_True ) +{ + const OUString sLName( OUString::createFromAscii( pLName ) ); + StartElement( nPrefixKey, sLName, bIWSOutside ); +} + +SvXMLElementExport::SvXMLElementExport( + SvXMLExport& rExp, + sal_uInt16 nPrefixKey, + const OUString& rLName, + sal_Bool bIWSOutside, + sal_Bool bIWSInside ) + : mrExport( rExp ) + , maElementName() + , mbIgnoreWhitespaceInside( bIWSInside ) + , mbDoSomething( sal_True ) +{ + StartElement( nPrefixKey, rLName, bIWSOutside ); +} + +SvXMLElementExport::SvXMLElementExport( + SvXMLExport& rExp, + sal_uInt16 nPrefixKey, + enum XMLTokenEnum eLName, + sal_Bool bIWSOutside, + sal_Bool bIWSInside ) + : mrExport( rExp ) + , maElementName() + , mbIgnoreWhitespaceInside( bIWSInside ) + , mbDoSomething( sal_True ) +{ + StartElement( nPrefixKey, GetXMLToken(eLName), bIWSOutside ); +} + +SvXMLElementExport::SvXMLElementExport( + SvXMLExport& rExp, + sal_Bool bDoSth, + sal_uInt16 nPrefixKey, + enum XMLTokenEnum eLName, + sal_Bool bIWSOutside, + sal_Bool bIWSInside ) + : mrExport( rExp ) + , maElementName() + , mbIgnoreWhitespaceInside( bIWSInside ) + , mbDoSomething( bDoSth ) +{ + if ( mbDoSomething ) + StartElement( nPrefixKey, GetXMLToken( eLName ), bIWSOutside ); +} + +SvXMLElementExport::SvXMLElementExport( + SvXMLExport& rExp, + const OUString& rQName, + sal_Bool bIWSOutside, + sal_Bool bIWSInside ) + : mrExport( rExp ) + , maElementName() + , mbIgnoreWhitespaceInside( bIWSInside ) + , mbDoSomething( sal_True ) +{ + maElementName = rQName; rExp.StartElement( rQName, bIWSOutside ); } SvXMLElementExport::~SvXMLElementExport() { - if( bDoSomething ) + if ( mbDoSomething ) { - rExport.EndElement( aName, bIgnWS ); + mrExport.EndElement( maElementName, mbIgnoreWhitespaceInside ); } } diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 259633d..b122e66 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1979,7 +1979,8 @@ void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) { if (!lcl_HasListStyle( m_pImpl->m_pOutlineStylesCandidates[i][j], - m_pImpl->m_xParaStyles, GetXMLImport(), + m_pImpl->m_xParaStyles, + GetXMLImport(), s_NumberingStyleName, sOutlineStyleName)) { diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 0dcdefc..95f6f0ce5 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -3220,9 +3220,9 @@ void XMLTextParagraphExport::setTextEmbeddedGraphicURL( } sal_Bool XMLTextParagraphExport::addHyperlinkAttributes( - const Reference < XPropertySet > & rPropSet, - const Reference < XPropertyState > & rPropState, - const Reference < XPropertySetInfo > & rPropSetInfo ) + const Reference< XPropertySet > & rPropSet, + const Reference< XPropertyState > & rPropState, + const Reference< XPropertySetInfo > & rPropSetInfo ) { sal_Bool bExport = sal_False; OUString sHRef, sName, sTargetFrame, sUStyleName, sVStyleName; @@ -3238,52 +3238,59 @@ sal_Bool XMLTextParagraphExport::addHyperlinkAttributes( bExport = sal_True; } - if( rPropSetInfo->hasPropertyByName( sHyperLinkName ) && - ( !rPropState.is() || PropertyState_DIRECT_VALUE == - rPropState->getPropertyState( sHyperLinkName ) ) ) + if ( sHRef.isEmpty() ) + { + // hyperlink without an URL does not make sense + OSL_ENSURE( false, "hyperlink without an URL --> no export to ODF" ); + return sal_False; + } + + if ( rPropSetInfo->hasPropertyByName( sHyperLinkName ) + && ( !rPropState.is() + || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sHyperLinkName ) ) ) { rPropSet->getPropertyValue( sHyperLinkName ) >>= sName; if( !sName.isEmpty() ) bExport = sal_True; } - if( rPropSetInfo->hasPropertyByName( sHyperLinkTarget ) && - ( !rPropState.is() || PropertyState_DIRECT_VALUE == - rPropState->getPropertyState( sHyperLinkTarget ) ) ) + if ( rPropSetInfo->hasPropertyByName( sHyperLinkTarget ) + && ( !rPropState.is() + || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sHyperLinkTarget ) ) ) { rPropSet->getPropertyValue( sHyperLinkTarget ) >>= sTargetFrame; if( !sTargetFrame.isEmpty() ) bExport = sal_True; } - if( rPropSetInfo->hasPropertyByName( sServerMap ) && - ( !rPropState.is() || PropertyState_DIRECT_VALUE == - rPropState->getPropertyState( sServerMap ) ) ) + if ( rPropSetInfo->hasPropertyByName( sServerMap ) + && ( !rPropState.is() + || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sServerMap ) ) ) { - bServerMap = *(sal_Bool *)rPropSet->getPropertyValue( sServerMap ).getValue(); - if( bServerMap ) + bServerMap = *(sal_Bool *) rPropSet->getPropertyValue( sServerMap ).getValue(); + if ( bServerMap ) bExport = sal_True; } - if( rPropSetInfo->hasPropertyByName( sUnvisitedCharStyleName ) && - ( !rPropState.is() || PropertyState_DIRECT_VALUE == - rPropState->getPropertyState( sUnvisitedCharStyleName ) ) ) + if ( rPropSetInfo->hasPropertyByName( sUnvisitedCharStyleName ) + && ( !rPropState.is() + || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sUnvisitedCharStyleName ) ) ) { rPropSet->getPropertyValue( sUnvisitedCharStyleName ) >>= sUStyleName; if( !sUStyleName.isEmpty() ) bExport = sal_True; } - if( rPropSetInfo->hasPropertyByName( sVisitedCharStyleName ) && - ( !rPropState.is() || PropertyState_DIRECT_VALUE == - rPropState->getPropertyState( sVisitedCharStyleName ) ) ) + if ( rPropSetInfo->hasPropertyByName( sVisitedCharStyleName ) + && ( !rPropState.is() + || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sVisitedCharStyleName ) ) ) { rPropSet->getPropertyValue( sVisitedCharStyleName ) >>= sVStyleName; if( !sVStyleName.isEmpty() ) bExport = sal_True; } - if( bExport ) + if ( bExport ) { GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( sHRef ) ); @@ -3315,14 +3322,46 @@ sal_Bool XMLTextParagraphExport::addHyperlinkAttributes( return bExport; } +void XMLTextParagraphExport::exportTextRangeSpan( + const com::sun::star::uno::Reference< com::sun::star::text::XTextRange > & rTextRange, + Reference< XPropertySet > & xPropSet, + Reference < XPropertySetInfo > & xPropSetInfo, + const sal_Bool bIsUICharStyle, + const sal_Bool bHasAutoStyle, + const OUString& sStyle, + bool& rPrevCharIsSpace, + FieldmarkType& openFieldMark ) +{ + XMLTextCharStyleNamesElementExport aCharStylesExport( + GetExport(), + bIsUICharStyle && aCharStyleNamesPropInfoCache.hasProperty( xPropSet, xPropSetInfo ), + bHasAutoStyle, + xPropSet, + sCharStyleNames ); + + if ( !sStyle.isEmpty() ) + { + GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( sStyle ) ); + } + { + SvXMLElementExport aElement( GetExport(), !sStyle.isEmpty(), XML_NAMESPACE_TEXT, XML_SPAN, sal_False, sal_False ); + const OUString aText( rTextRange->getString() ); + SvXMLElementExport aElem2( GetExport(), TEXT == openFieldMark, + XML_NAMESPACE_TEXT, XML_TEXT_INPUT, + sal_False, sal_False ); + exportText( aText, rPrevCharIsSpace ); + openFieldMark = NONE; + } +} + void XMLTextParagraphExport::exportTextRange( - const Reference < XTextRange > & rTextRange, + const Reference< XTextRange > & rTextRange, sal_Bool bAutoStyles, bool& rPrevCharIsSpace, FieldmarkType& openFieldMark ) { - Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY ); - if( bAutoStyles ) + Reference< XPropertySet > xPropSet( rTextRange, UNO_QUERY ); + if ( bAutoStyles ) { Add( XML_STYLE_FAMILY_TEXT_TEXT, xPropSet ); } @@ -3331,54 +3370,36 @@ void XMLTextParagraphExport::exportTextRange( sal_Bool bHyperlink = sal_False; sal_Bool bIsUICharStyle = sal_False; sal_Bool bHasAutoStyle = sal_False; - - OUString sStyle(FindTextStyleAndHyperlink( xPropSet, bHyperlink, - bIsUICharStyle, bHasAutoStyle )); + const OUString sStyle( + FindTextStyleAndHyperlink( xPropSet, bHyperlink, bIsUICharStyle, bHasAutoStyle ) ); Reference < XPropertySetInfo > xPropSetInfo; - if( bHyperlink ) + sal_Bool bHyperlinkAttrsAdded = sal_False; + if ( bHyperlink ) { Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY ); - xPropSetInfo.set(xPropSet->getPropertySetInfo()); - bHyperlink = addHyperlinkAttributes( xPropSet, xPropState, xPropSetInfo ); + xPropSetInfo.set( xPropSet->getPropertySetInfo() ); + bHyperlinkAttrsAdded = addHyperlinkAttributes( xPropSet, xPropState, xPropSetInfo ); } - SvXMLElementExport aElem( GetExport(), bHyperlink, XML_NAMESPACE_TEXT, - XML_A, sal_False, sal_False ); - if( bHyperlink ) + + if ( bHyperlink && bHyperlinkAttrsAdded ) { + SvXMLElementExport aElem( GetExport(), sal_True, XML_NAMESPACE_TEXT, XML_A, sal_False, sal_False ); + // export events (if supported) OUString sHyperLinkEvents( "HyperLinkEvents"); if (xPropSetInfo->hasPropertyByName(sHyperLinkEvents)) { - Reference<XNameReplace> xName(xPropSet->getPropertyValue(sHyperLinkEvents), uno::UNO_QUERY); - GetExport().GetEventExport().Export(xName, sal_False); + Reference< XNameReplace > xName( xPropSet->getPropertyValue( sHyperLinkEvents ), uno::UNO_QUERY ); + GetExport().GetEventExport().Export( xName, sal_False ); } - } + exportTextRangeSpan( rTextRange, xPropSet, xPropSetInfo, bIsUICharStyle, bHasAutoStyle, sStyle, rPrevCharIsSpace, openFieldMark ); + } + else { - XMLTextCharStyleNamesElementExport aCharStylesExport( - GetExport(), bIsUICharStyle && - aCharStyleNamesPropInfoCache.hasProperty( - xPropSet, xPropSetInfo ), bHasAutoStyle, - xPropSet, sCharStyleNames ); - - OUString aText(rTextRange->getString()); - if( !sStyle.isEmpty() ) - GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, - GetExport().EncodeStyleName( sStyle ) ); - { - // in a block to make sure it is destroyed before the text:a element - SvXMLElementExport aElement( GetExport(), !sStyle.isEmpty(), - XML_NAMESPACE_TEXT, XML_SPAN, sal_False, - sal_False ); - - SvXMLElementExport aElem2( GetExport(), TEXT == openFieldMark, - XML_NAMESPACE_TEXT, XML_TEXT_INPUT, - sal_False, sal_False ); - exportText( aText, rPrevCharIsSpace ); - openFieldMark = NONE; - } + exportTextRangeSpan( rTextRange, xPropSet, xPropSetInfo, bIsUICharStyle, bHasAutoStyle, sStyle, rPrevCharIsSpace, openFieldMark ); } } } diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index 2867e5d..75a856d 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -314,10 +314,10 @@ public: class XMLImpHyperlinkContext_Impl : public SvXMLImportContext { - XMLHints_Impl& rHints; - XMLHyperlinkHint_Impl *pHint; + XMLHints_Impl& mrHints; + XMLHyperlinkHint_Impl *mpHint; - sal_Bool& rIgnoreLeadingSpace; + sal_Bool& mrbIgnoreLeadingSpace; public: @@ -343,71 +343,77 @@ public: TYPEINIT1( XMLImpHyperlinkContext_Impl, SvXMLImportContext ); XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl( - SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList, - XMLHints_Impl& rHnts, - sal_Bool& rIgnLeadSpace ) : - SvXMLImportContext( rImport, nPrfx, rLName ), - rHints( rHnts ), - pHint( new XMLHyperlinkHint_Impl( - GetImport().GetTextImport()->GetCursorAsRange()->getStart() ) ), - rIgnoreLeadingSpace( rIgnLeadSpace ) + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLName, + const Reference< xml::sax::XAttributeList > & xAttrList, + XMLHints_Impl& rHnts, + sal_Bool& rIgnLeadSpace ) + : SvXMLImportContext( rImport, nPrfx, rLName ) + , mrHints( rHnts ) + , mpHint( new XMLHyperlinkHint_Impl( GetImport().GetTextImport()->GetCursorAsRange()->getStart() ) ) + , mrbIgnoreLeadingSpace( rIgnLeadSpace ) { OUString sShow; - const SvXMLTokenMap& rTokenMap = - GetImport().GetTextImport()->GetTextHyperlinkAttrTokenMap(); + const SvXMLTokenMap& rTokenMap = GetImport().GetTextImport()->GetTextHyperlinkAttrTokenMap(); sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for( sal_Int16 i=0; i < nAttrCount; i++ ) + for ( sal_Int16 i = 0; i < nAttrCount; i++ ) { const OUString& rAttrName = xAttrList->getNameByIndex( i ); const OUString& rValue = xAttrList->getValueByIndex( i ); OUString aLocalName; - sal_uInt16 nPrefix = - GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, - &aLocalName ); - switch( rTokenMap.Get( nPrefix, aLocalName ) ) + const sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ); + switch (rTokenMap.Get( nPrefix, aLocalName )) { case XML_TOK_TEXT_HYPERLINK_HREF: - pHint->SetHRef( GetImport().GetAbsoluteReference( rValue ) ); + mpHint->SetHRef( GetImport().GetAbsoluteReference( rValue ) ); break; case XML_TOK_TEXT_HYPERLINK_NAME: - pHint->SetName( rValue ); + mpHint->SetName( rValue ); break; case XML_TOK_TEXT_HYPERLINK_TARGET_FRAME: - pHint->SetTargetFrameName( rValue ); + mpHint->SetTargetFrameName( rValue ); break; case XML_TOK_TEXT_HYPERLINK_SHOW: sShow = rValue; break; case XML_TOK_TEXT_HYPERLINK_STYLE_NAME: - pHint->SetStyleName( rValue ); + mpHint->SetStyleName( rValue ); break; case XML_TOK_TEXT_HYPERLINK_VIS_STYLE_NAME: - pHint->SetVisitedStyleName( rValue ); + mpHint->SetVisitedStyleName( rValue ); break; } } - if( !sShow.isEmpty() && pHint->GetTargetFrameName().isEmpty() ) + if( !sShow.isEmpty() && mpHint->GetTargetFrameName().isEmpty() ) { if( IsXMLToken( sShow, XML_NEW ) ) - pHint->SetTargetFrameName( + mpHint->SetTargetFrameName( OUString( "_blank" ) ); else if( IsXMLToken( sShow, XML_REPLACE ) ) - pHint->SetTargetFrameName( + mpHint->SetTargetFrameName( OUString( "_self" ) ); } - rHints.push_back( pHint ); + + if ( mpHint->GetHRef().isEmpty() ) + { + // hyperlink without an URL is not imported. + delete mpHint; + mpHint = NULL; + } + else + { + mrHints.push_back( mpHint ); + } } XMLImpHyperlinkContext_Impl::~XMLImpHyperlinkContext_Impl() { - if( pHint ) - pHint->SetEnd( GetImport().GetTextImport() + if( mpHint != NULL ) + mpHint->SetEnd( GetImport().GetTextImport() ->GetCursorAsRange()->getStart() ); } @@ -420,7 +426,7 @@ SvXMLImportContext *XMLImpHyperlinkContext_Impl::CreateChildContext( { XMLEventsImportContext* pCtxt = new XMLEventsImportContext( GetImport(), nPrefix, rLocalName); - pHint->SetEventsContext(pCtxt); + mpHint->SetEventsContext(pCtxt); return pCtxt; } else @@ -431,13 +437,13 @@ SvXMLImportContext *XMLImpHyperlinkContext_Impl::CreateChildContext( return XMLImpSpanContext_Impl::CreateChildContext( GetImport(), nPrefix, rLocalName, xAttrList, - nToken, rHints, rIgnoreLeadingSpace ); + nToken, mrHints, mrbIgnoreLeadingSpace ); } } void XMLImpHyperlinkContext_Impl::Characters( const OUString& rChars ) { - GetImport().GetTextImport()->InsertString( rChars, rIgnoreLeadingSpace ); + GetImport().GetTextImport()->InsertString( rChars, mrbIgnoreLeadingSpace ); } class XMLImpRubyBaseContext_Impl : public SvXMLImportContext @@ -1600,25 +1606,23 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext( // test for HyperLinkURL property. If present, insert link as // text property (StarWriter), else try to insert as text // field (StarCalc, StarDraw, ...) - Reference<beans::XPropertySet> xPropSet( - rImport.GetTextImport()->GetCursor(), - UNO_QUERY ); + Reference< beans::XPropertySet > xPropSet( rImport.GetTextImport()->GetCursor(), UNO_QUERY ); - const OUString sHyperLinkURL( - "HyperLinkURL"); + const OUString sHyperLinkURL("HyperLinkURL"); - if (xPropSet->getPropertySetInfo()->hasPropertyByName(sHyperLinkURL)) + if ( xPropSet->getPropertySetInfo()->hasPropertyByName( sHyperLinkURL ) ) { - pContext = new XMLImpHyperlinkContext_Impl( rImport, nPrefix, - rLocalName, xAttrList, - rHints, - rIgnoreLeadingSpace ); + pContext = new XMLImpHyperlinkContext_Impl( + rImport, + nPrefix, + rLocalName, + xAttrList, + rHints, + rIgnoreLeadingSpace ); } else { - pContext = new XMLUrlFieldImportContext( rImport, - *rImport.GetTextImport().get(), - nPrefix, rLocalName); + pContext = new XMLUrlFieldImportContext( rImport, *rImport.GetTextImport().get(), nPrefix, rLocalName ); //whitespace handling like other fields rIgnoreLeadingSpace = sal_False; commit d762c154178399a2ec1ab1d6aa9e8d5133f93d63 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jan 16 09:44:56 2014 +0000 low hanging xub_StrLen->sal_Int32 in editeng Change-Id: I8d9a504a1e7d320b487ee499b5bc0c04b52632e7 diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 14df4f3..ec52862 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -935,7 +935,7 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/; ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(pLineString), aLine.getLength(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW - sal_uInt16 nVisPos = bStart ? 0 : aLine.getLength()-1; + sal_Int32 nVisPos = bStart ? 0 : aLine.getLength()-1; const sal_Int32 nLogPos = ubidi_getLogicalIndex( pBidi, nVisPos, &nError ); ubidi_close( pBidi ); @@ -2586,7 +2586,7 @@ EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, OUString aNewText( aOldText ); if (pCTLOptions->IsCTLSequenceCheckingTypeAndReplace()) { - /*const xub_StrLen nPrevPos = static_cast< xub_StrLen >*/( _xISC->correctInputSequence( aNewText, nTmpPos - 1, c, nCheckMode ) ); + _xISC->correctInputSequence(aNewText, nTmpPos - 1, c, nCheckMode); // find position of first character that has changed sal_Int32 nOldLen = aOldText.getLength(); @@ -2679,10 +2679,10 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& aCurSel, const OUStrin if ( nEnd > nStart ) { OUString aLine = aText.copy( nStart, nEnd-nStart ); - xub_StrLen nChars = aPaM.GetNode()->Len() + aLine.getLength(); + sal_Int32 nChars = aPaM.GetNode()->Len() + aLine.getLength(); if ( nChars > MAXCHARSINPARA ) { - xub_StrLen nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len(); + sal_Int32 nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len(); nEnd -= ( aLine.getLength() - nMaxNewChars ); // Then the characters end up in the next paragraph. aLine = aLine.copy( 0, nMaxNewChars ); // Delete the Rest... } diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx index c7a3860..e5bd328 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -64,7 +64,7 @@ void SvxPrepareAutoCorrect( OUString &rOldText, const OUString &rNewText ) // rOldText: text to be replaced // rNewText: replacement text - xub_StrLen nOldLen = rOldText.getLength(), + sal_Int32 nOldLen = rOldText.getLength(), nNewLen = rNewText.getLength(); if (nOldLen && nNewLen) { commit 557fbb450b67280d967fa9a16f9daa3215baacba Author: Tsutomu Uchino <ha...@apache.org> Date: Wed Jan 15 14:32:27 2014 +0000 Resolves: #i123725# choose by default the following options... Insert or delete cells and Keep formatting options on define database range dialog (cherry picked from commit f8be427cd9b311b98e84d673dea15d917acde81c) Conflicts: sc/source/ui/dbgui/dbnamdlg.cxx Change-Id: I4695cb8528b3bf38a08c26d5ff448c0bd37b7172 diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index 89d34fd..796ede7 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -177,6 +177,8 @@ ScDbNameDlg::~ScDbNameDlg() void ScDbNameDlg::Init() { m_pBtnHeader->Check( sal_True ); // Default: mit Spaltenkoepfen + m_pBtnDoSize->Check( sal_True ); + m_pBtnKeepFmt->Check( sal_True ); m_pBtnOk->SetClickHdl ( LINK( this, ScDbNameDlg, OkBtnHdl ) ); m_pBtnCancel->SetClickHdl ( LINK( this, ScDbNameDlg, CancelBtnHdl ) );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits