Commits

Anonymous committed 6e815a4

Fixed the problem with phonetic data import from ods documents.

  • Participants
  • Parent commits cce6447

Comments (0)

Files changed (6)

File sc/source/core/tool/interpr4.cxx

         return;
 
     const String& rPhoneticString = aPhonetic.GetString();
-    ScPhonetic::PortionVec portions = aPhonetic.GetPortions();
+    const ScPhonetic::PortionVec& portions = aPhonetic.GetPortions();
     sal_uInt16 nPortionCount = portions.size();
 
     String tmpString;

File sc/source/filter/xml/XMLTextPContext.cxx

 		GetScImport().SetRemoveLastChar(sal_True);
 	}
     if ( sOURubyText )
-        pCellContext->SetPhoneticText( sOURubyText.makeStringAndClear() );
+        pCellContext->SetPhoneticText( sOURubyText.makeStringAndClear(), aPhoneticPortions );
 }
 
 void ScXMLTextPContext::GetContent( rtl::OUString& rContent )

File sc/source/filter/xml/XMLTextPContext.hxx

 	USHORT						nPrefix;
 	sal_Bool					bIsOwn;
     rtl::OUStringBuffer         sOURubyText;
-    ScPhonetic::PortionVec          aPhoneticPortions;
+    ScPhonetic::PortionVec      aPhoneticPortions;
 
 	const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
 	ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }

File sc/source/filter/xml/xmlcelli.cxx

 }
 
 static ScBaseCell* lcl_CreateTextCell ( const String& rString, ScDocument* pDoc, 
-                                        const ::boost::optional< ::rtl::OUString >& pPhoneticText )
+                                        const ::boost::optional< ::rtl::OUString >& pPhoneticText,
+                                        const ScPhonetic::PortionVec& rPortions )
 {
     ScBaseCell *pCell = 0;
 
     if ( pPhoneticText && pPhoneticText->getLength() )
     {
-        ScPhonetic::PortionVec xPortions;
         sal_uInt16 aKanaType = lcl_GetKanaType ( pPhoneticText );
-        ScPhonetic aPhonetic ( 0, 0x30 | aKanaType , 0, *pPhoneticText, xPortions );
+        ScPhonetic aPhonetic ( 0, 0x30 | aKanaType , 0, *pPhoneticText, rPortions );
         pCell = new ScAsianStringCell( rString, aPhonetic );
     }
     else
                                                 ScBaseCell* pNewCell = NULL;
                                                 ScDocument* pDoc = rXMLImport.GetDocument();
                                                 if (pOUTextValue && pOUTextValue->getLength())
-                                                    pNewCell = lcl_CreateTextCell( *pOUTextValue, pDoc, pOUPhoneticText );
+                                                    pNewCell = lcl_CreateTextCell( *pOUTextValue, pDoc, pOUPhoneticText, aPhoneticPortions );
                                                 else if (pOUTextContent && pOUTextContent->getLength())
-                                                    pNewCell = lcl_CreateTextCell( *pOUTextContent, pDoc, pOUPhoneticText );
+                                                    pNewCell = lcl_CreateTextCell( *pOUTextContent, pDoc, pOUPhoneticText, aPhoneticPortions );
                                                 else if ( i > 0 && pOUText && pOUText->getLength() )
-                                                    pNewCell = lcl_CreateTextCell( *pOUText, pDoc, pOUPhoneticText );
+                                                    pNewCell = lcl_CreateTextCell( *pOUText, pDoc, pOUPhoneticText, aPhoneticPortions );
 
                                                 bDoIncrement = pNewCell != NULL;
                                                 if ( bDoIncrement )
 	nCellsRepeated = 1;
 }
 
-void ScXMLTableRowCellContext::SetPhoneticText(const rtl::OUString& rOUPhoneticText)
+void ScXMLTableRowCellContext::SetPhoneticText(const rtl::OUString& rOUPhoneticText, const ScPhonetic::PortionVec& rPortions)
 {
     pOUPhoneticText.reset(rOUPhoneticText);
+    aPhoneticPortions = rPortions;
 }
 

File sc/source/filter/xml/xmlcelli.hxx

 #include <com/sun/star/document/XActionLockable.hpp>
 
 #include "formula/grammar.hxx"
+#include "phonetic.hxx"
 #include <boost/optional.hpp>
 
 class ScXMLImport;
 	::boost::optional< rtl::OUString > pOUTextValue;
 	::boost::optional< rtl::OUString > pOUTextContent;
     ::boost::optional< FormulaWithNamespace > pOUFormula;
-	::boost::optional< rtl::OUString > pOUPhoneticText;
+    ::boost::optional< rtl::OUString > pOUPhoneticText;
+    ScPhonetic::PortionVec aPhoneticPortions;
 	rtl::OUString* pContentValidationName;
     ::std::auto_ptr< ScXMLAnnotationData > mxAnnotationData;
 	ScMyImpDetectiveObjVec*	pDetectiveObjVec;
      *  
      * @param rOUPhoneticText the phonetic text
      */
-    void SetPhoneticText(const rtl::OUString& rOUPhoneticText);
+    void SetPhoneticText(const rtl::OUString& rOUPhoneticText, const ScPhonetic::PortionVec& rPortions);
 };
 
 #endif

File sc/source/filter/xml/xmlrubyi.cxx

 {
     SvXMLImportContext *pContext(NULL);
 
-    const SvXMLTokenMap& rTokenMap = GetScImport().GetTableRowCellElemTextRubyTokenMap();
+    const SvXMLTokenMap& rTokenMap = GetScImport().GetTableRowCellElemTextRubyAttrTokenMap();
     switch( rTokenMap.Get( nPrefix, rLName ) )
     {
     case XML_TOK_TABLE_ROW_CELL_TEXT_RUBY_BASE:
     if ( pTextContext )
         pTextContext->AddRubyText( sBaseText.makeStringAndClear(), sRubyText.makeStringAndClear() );
     else if ( pCellContext )
-        pCellContext->SetPhoneticText( sRubyText.makeStringAndClear() );
+        pCellContext->SetPhoneticText( sRubyText.makeStringAndClear(), ScPhonetic::PortionVec() );
 }
 
 void ScXMLRubyContext::AddBaseText( const ::rtl::OUString& rText )