richstring.cxx (cdf0e10c) richstring.cxx (0dac23a0)
1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *

--- 94 unchanged lines hidden (view full) ---

103 if( xRange.is() )
104 {
105 xRange->setString( maText );
106 if( mxFont.get() )
107 {
108 PropertySet aPropSet( xRange );
109 mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
110 }
1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *

--- 94 unchanged lines hidden (view full) ---

103 if( xRange.is() )
104 {
105 xRange->setString( maText );
106 if( mxFont.get() )
107 {
108 PropertySet aPropSet( xRange );
109 mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
110 }
111
112 /* Some font attributes cannot be set to cell formattiing in Calc but
113 require to use rich formatting, e.g. font escapement. */
114 if( lclNeedsRichTextFormat( pFont ) )
111 /* Some font attributes cannot be set to cell formatting in Calc but
112 require to use rich formatting, e.g. font escapement. But do not
113 use the passed font if this portion has its own font. */
114 else if( lclNeedsRichTextFormat( pFont ) )
115 {
116 PropertySet aPropSet( xRange );
117 pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
118 }
119 }
120}
121
122// ----------------------------------------------------------------------------

--- 394 unchanged lines hidden (view full) ---

517 if( maTextPortions.empty() )
518 {
519 orString = OUString();
520 return true;
521 }
522 if( (maTextPortions.size() == 1) && !maTextPortions.front()->hasFont() && !lclNeedsRichTextFormat( pFirstPortionFont ) )
523 {
524 orString = maTextPortions.front()->getText();
115 {
116 PropertySet aPropSet( xRange );
117 pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
118 }
119 }
120}
121
122// ----------------------------------------------------------------------------

--- 394 unchanged lines hidden (view full) ---

517 if( maTextPortions.empty() )
518 {
519 orString = OUString();
520 return true;
521 }
522 if( (maTextPortions.size() == 1) && !maTextPortions.front()->hasFont() && !lclNeedsRichTextFormat( pFirstPortionFont ) )
523 {
524 orString = maTextPortions.front()->getText();
525 return true;
525 return orString.indexOf( '\x0A' ) < 0;
526 }
527 return false;
528}
529
526 }
527 return false;
528}
529
530void RichString::convert( const Reference< XText >& rxText, const Font* pFirstPortionFont ) const
530void RichString::convert( const Reference< XText >& rxText, bool bReplaceOld, const Font* pFirstPortionFont ) const
531{
531{
532 bool bReplace = true;
533 for( PortionVector::const_iterator aIt = maTextPortions.begin(), aEnd = maTextPortions.end(); aIt != aEnd; ++aIt )
534 {
532 for( PortionVector::const_iterator aIt = maTextPortions.begin(), aEnd = maTextPortions.end(); aIt != aEnd; ++aIt )
533 {
535 (*aIt)->convert( rxText, pFirstPortionFont, bReplace );
534 (*aIt)->convert( rxText, pFirstPortionFont, bReplaceOld );
536 pFirstPortionFont = 0; // use passed font for first portion only
535 pFirstPortionFont = 0; // use passed font for first portion only
537 bReplace = false; // do not replace first portion text with following portions
536 bReplaceOld = false; // do not replace first portion text with following portions
538 }
539}
540
541// private --------------------------------------------------------------------
542
543RichStringPortionRef RichString::createPortion()
544{
545 RichStringPortionRef xPortion( new RichStringPortion( *this ) );

--- 99 unchanged lines hidden ---
537 }
538}
539
540// private --------------------------------------------------------------------
541
542RichStringPortionRef RichString::createPortion()
543{
544 RichStringPortionRef xPortion( new RichStringPortion( *this ) );

--- 99 unchanged lines hidden ---