[Libreoffice-commits] core.git: Branch 'aoo/trunk' - oox/inc oox/source

2014-05-26 Thread Clarence Guo
 oox/inc/oox/xls/richstring.hxx |1 +
 oox/source/xls/richstring.cxx  |   10 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit d39da40700ceab57e9f80bd9851598e1d455f121
Author: Clarence Guo clarence_...@apache.org
Date:   Mon May 26 03:03:05 2014 +

for #i124928, rich text portion could be converted several times, each time 
when it is converted, the string will be set once, but in the setString logic, 
the text is inserted instead of set.

Repeated conversion is unnecessary, add a flag to avoid repeated conversion

diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx
index 18f177b..afd88f1 100644
--- a/oox/inc/oox/xls/richstring.hxx
+++ b/oox/inc/oox/xls/richstring.hxx
@@ -78,6 +78,7 @@ private:
 ::rtl::OUString maText; /// Portion text.
 FontRef mxFont; /// Embedded portion font, may be 
empty.
 sal_Int32   mnFontId;   /// Link to global font list.
+boolmbConverted;/// Without repeatly convert
 };
 
 typedef ::boost::shared_ptr RichStringPortion  RichStringPortionRef;
diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx
index b2349ab..1fb24f4 100644
--- a/oox/source/xls/richstring.cxx
+++ b/oox/source/xls/richstring.cxx
@@ -19,8 +19,6 @@
  *
  */
 
-
-
 #include oox/xls/richstring.hxx
 
 #include com/sun/star/text/XText.hpp
@@ -59,7 +57,8 @@ inline bool lclNeedsRichTextFormat( const Font* pFont )
 
 RichStringPortion::RichStringPortion( const WorkbookHelper rHelper ) :
 WorkbookHelper( rHelper ),
-mnFontId( -1 )
+mnFontId( -1 ),
+mbConverted( false )
 {
 }
 
@@ -89,6 +88,9 @@ void RichStringPortion::finalizeImport()
 
 void RichStringPortion::convert( const Reference XText  rxText, const Font* 
pFont, bool bReplace )
 {
+if ( mbConverted )
+return;
+
 Reference XTextRange  xRange;
 if( bReplace )
 xRange.set( rxText, UNO_QUERY );
@@ -113,6 +115,8 @@ void RichStringPortion::convert( const Reference XText  
rxText, const Font* p
 pFont-writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
 }
 }
+
+mbConverted = true;
 }
 
 // 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'aoo/trunk' - oox/inc oox/source

2013-12-29 Thread Steve Yin
 oox/inc/oox/xls/worksheethelper.hxx  |1 +
 oox/source/xls/worksheetfragment.cxx |1 +
 oox/source/xls/worksheethelper.cxx   |   20 
 3 files changed, 22 insertions(+)

New commits:
commit 7e7e0c820f442e3a7ee1b5f6ad80fe7999a75f0b
Author: Steve Yin stev...@apache.org
Date:   Mon Dec 30 05:52:36 2013 +

Bug 123910 - The reference in validation condition change to #REF! in 
exported xls file

Build break fix

diff --git a/oox/inc/oox/xls/worksheethelper.hxx 
b/oox/inc/oox/xls/worksheethelper.hxx
index f32f53a..c0b8b2e 100644
--- a/oox/inc/oox/xls/worksheethelper.hxx
+++ b/oox/inc/oox/xls/worksheethelper.hxx
@@ -154,6 +154,7 @@ struct ValidationModel
 ApiCellRangeListmaRanges;
 ApiTokenSequencemaTokens1;
 ApiTokenSequencemaTokens2;
+::rtl::OUString msRef;
 ::rtl::OUString maInputTitle;
 ::rtl::OUString maInputMessage;
 ::rtl::OUString maErrorTitle;
diff --git a/oox/source/xls/worksheetfragment.cxx 
b/oox/source/xls/worksheetfragment.cxx
index 5c28866..cff0363 100644
--- a/oox/source/xls/worksheetfragment.cxx
+++ b/oox/source/xls/worksheetfragment.cxx
@@ -158,6 +158,7 @@ void DataValidationsContext::importDataValidation( const 
AttributeList rAttribs
 {
 mxValModel.reset( new ValidationModel );
 getAddressConverter().convertToCellRangeList( mxValModel-maRanges, 
rAttribs.getString( XML_sqref, OUString() ), getSheetIndex(), true );
+mxValModel-msRef  = rAttribs.getString( XML_sqref, OUString() );
 mxValModel-maInputTitle   = rAttribs.getXString( XML_promptTitle, 
OUString() );
 mxValModel-maInputMessage = rAttribs.getXString( XML_prompt, OUString() );
 mxValModel-maErrorTitle   = rAttribs.getXString( XML_errorTitle, 
OUString() );
diff --git a/oox/source/xls/worksheethelper.cxx 
b/oox/source/xls/worksheethelper.cxx
index 8174341..0f84cad 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -1093,6 +1093,26 @@ void WorksheetGlobals::finalizeValidationRanges() const
 {
 }
 
+try
+{
+sal_Int32 nIndex = 0;
+OUString aToken = aIt-msRef.getToken( 0, ' ', nIndex );
+
+ReferenceXSpreadsheet xSheet = getSheetFromDoc( 
getCurrentSheetIndex() );
+ReferenceXCellRange xDBCellRange;
+ReferenceXCell xCell;
+xDBCellRange = xSheet-getCellRangeByName( aToken );
+
+xCell = xDBCellRange-getCellByPosition( 0, 0 );
+ReferenceXCellAddressable xCellAddressable( xCell, 
UNO_QUERY_THROW );
+CellAddress aFirstCell = xCellAddressable-getCellAddress();
+ReferenceXSheetCondition xCondition( xValidation, 
UNO_QUERY_THROW );
+xCondition-setSourcePosition( aFirstCell );
+}
+catch( Exception )
+{
+}
+
 // convert validation type to API enum
 ValidationType eType = ValidationType_ANY;
 switch( aIt-mnType )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits