sw/inc/IDocumentSettingAccess.hxx | 1 + sw/inc/doc.hxx | 1 + sw/source/core/doc/dbgoutsw.cxx | 6 +++--- sw/source/core/doc/doc.cxx | 5 +++++ sw/source/core/doc/docnew.cxx | 1 + sw/source/core/text/guess.cxx | 8 ++++++-- sw/source/filter/ww8/ww8par.cxx | 1 + sw/source/filter/xml/xmlimp.cxx | 10 ++++++++++ sw/source/ui/uno/SwXDocumentSettings.cxx | 16 +++++++++++++++- writerfilter/source/filter/ImportFilter.cxx | 9 +++++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 4 ++++ 11 files changed, 56 insertions(+), 6 deletions(-)
New commits: commit 8a232f007458c9f474c6bf8fdf1f7f2c5ae467cf Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Fri Nov 11 22:11:58 2011 +0100 RTF import: Fixed unicode characters import, fdo#42109 Actually implemented the \uc to skip the ANSI representation after the unicode value. diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 9cc025c..7ba5249 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2221,6 +2221,10 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } } break; + case RTF_UC: + if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_INT16)) + m_aStates.top().nUc = nParam; + break; case RTF_U: if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_INT16)) { commit 74b6759ee81c95ae75046dd411d2bd0bd2324a8b Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Thu Nov 10 16:10:25 2011 +0100 n#707157: Word doesn't break the numberings and prefers hiding them Added a compatibility option to reproduce Word's behavior when importing Doc, docx and RTF files. The default behavior isn't changed. diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 50e8096..d912376 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -83,6 +83,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd COLLAPSE_EMPTY_CELL_PARA, SMALL_CAPS_PERCENTAGE_66, TAB_OVERFLOW, + UNBREAKABLE_NUMBERINGS, // COMPATIBILITY FLAGS END BROWSE_MODE, diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index e4848f5..8427b17 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -579,6 +579,7 @@ private: bool mbTabAtLeftIndentForParagraphsInList; // #i89181# - see above bool mbSmallCapsPercentage66; bool mbTabOverflow; + bool mbUnbreakableNumberings; bool mbLastBrowseMode : 1; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index bdded6f..326cfde 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -203,6 +203,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case COLLAPSE_EMPTY_CELL_PARA: return mbCollapseEmptyCellPara; case SMALL_CAPS_PERCENTAGE_66: return mbSmallCapsPercentage66; case TAB_OVERFLOW: return mbTabOverflow; + case UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings; case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked! case HTML_MODE: return mbHTMLMode; @@ -341,6 +342,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) case TAB_OVERFLOW: mbTabOverflow = value; break; + + case UNBREAKABLE_NUMBERINGS: + mbUnbreakableNumberings = value; + break; // COMPATIBILITY FLAGS END case BROWSE_MODE: //can be used temporary (load/save) when no ViewShell is avaiable diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index f8a0ce2..656fb20 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -358,6 +358,7 @@ SwDoc::SwDoc() mbCollapseEmptyCellPara = true; // hidden mbSmallCapsPercentage66 = false; // hidden mbTabOverflow = true; + mbUnbreakableNumberings = false; // // COMPATIBILITY FLAGS END diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index bc84437..83c1758 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -125,8 +125,12 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, if ( nLineWidth < 0 ) nLineWidth = 0; } + const bool bUnbreakableNumberings = rInf.GetTxtFrm()->GetTxtNode()-> + getIDocumentSettingAccess()->get(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS); + // first check if everything fits to line - if ( long ( nLineWidth ) * 2 > long ( nMaxLen ) * nPorHeight ) + if ( ( long ( nLineWidth ) * 2 > long ( nMaxLen ) * nPorHeight ) || + ( bUnbreakableNumberings && rPor.IsNumberPortion() ) ) { // call GetTxtSize with maximum compression (for kanas) rInf.GetTxtSize( &rSI, rInf.GetIdx(), nMaxLen, @@ -134,7 +138,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, nBreakWidth = nMinSize; - if ( nBreakWidth <= nLineWidth ) + if ( ( nBreakWidth <= nLineWidth ) || ( bUnbreakableNumberings && rPor.IsNumberPortion() ) ) { // portion fits to line nCutPos = rInf.GetIdx() + nMaxLen; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 0f8f732..50530c1 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1580,6 +1580,7 @@ void SwWW8ImplReader::ImportDop() rDoc.set(IDocumentSettingAccess::INVERT_BORDER_SPACING, true); rDoc.set(IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA, true); rDoc.set(IDocumentSettingAccess::TAB_OVERFLOW, true); + rDoc.set(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS, true); // // COMPATIBILITY FLAGS END diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 06b95b3..5ba8ba9 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1192,6 +1192,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC aSet.insert(String("PrintEmptyPages", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("SmallCapsPercentage66", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("TabOverflow", RTL_TEXTENCODING_ASCII_US)); + aSet.insert(String("UnbreakableNumberings", RTL_TEXTENCODING_ASCII_US)); sal_Int32 nCount = aConfigProps.getLength(); const PropertyValue* pValues = aConfigProps.getConstArray(); @@ -1222,6 +1223,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bool bUseOldPrinterMetrics = false; bool bSmallCapsPercentage66 = false; bool bTabOverflow = false; + bool bUnbreakableNumberings = false; OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) ); @@ -1293,6 +1295,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bSmallCapsPercentage66 = true; else if( pValues->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("TabOverflow")) ) bTabOverflow = true; + else if( pValues->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UnbreakableNumberings")) ) + bUnbreakableNumberings = true; } catch( Exception& ) { @@ -1452,6 +1456,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC OUString( RTL_CONSTASCII_USTRINGPARAM("TabOverflow") ), makeAny( false ) ); } + if ( !bUnbreakableNumberings ) + { + xProps->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("UnbreakableNumberings") ), makeAny( false ) ); + } + Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY ); Reference < XText > xText = xTextDoc->getText(); Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index bba60d9..92aeb82 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -124,7 +124,8 @@ enum SwDocumentSettingsPropertyHandles HANDLE_INVERT_BORDER_SPACING, HANDLE_COLLAPSE_EMPTY_CELL_PARA, HANDLE_SMALL_CAPS_PERCENTAGE_66, - HANDLE_TAB_OVERFLOW + HANDLE_TAB_OVERFLOW, + HANDLE_UNBREAKABLE_NUMBERINGS }; MasterPropertySetInfo * lcl_createSettingsInfo() @@ -184,6 +185,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo() { RTL_CONSTASCII_STRINGPARAM("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("TabOverflow"), HANDLE_TAB_OVERFLOW, CPPUTYPE_BOOLEAN, 0, 0}, + { RTL_CONSTASCII_STRINGPARAM("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, CPPUTYPE_BOOLEAN, 0, 0}, /* * As OS said, we don't have a view when we need to set this, so I have to * find another solution before adding them to this property set - MTG @@ -716,6 +718,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->set(IDocumentSettingAccess::TAB_OVERFLOW, bTmp); } break; + case HANDLE_UNBREAKABLE_NUMBERINGS: + { + sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); + mpDoc->set(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS, bTmp); + } + break; default: throw UnknownPropertyException(); } @@ -1072,6 +1080,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue.setValue( &bTmp, ::getBooleanCppuType() ); } break; + case HANDLE_UNBREAKABLE_NUMBERINGS: + { + sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS ); + rValue.setValue( &bTmp, ::getBooleanCppuType() ); + } + break; default: throw UnknownPropertyException(); } diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index 2950f9f..5ac315c 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -28,8 +28,10 @@ #include <osl/diagnose.h> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/mediadescriptor.hxx> #include <oox/core/filterdetect.hxx> #include <dmapper/DomainMapper.hxx> @@ -175,6 +177,13 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >& throw (lang::IllegalArgumentException, uno::RuntimeException) { m_xDstDoc = xDoc; + + // Set some compatibility options that are valid for all the formats + uno::Reference< lang::XMultiServiceFactory > xFactory( xDoc, uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xSettings( xFactory->createInstance( + rtl::OUString::createFromAscii( "com.sun.star.document.Settings" ) ), uno::UNO_QUERY ); + + xSettings->setPropertyValue( rtl::OUString::createFromAscii( "UnbreakableNumberings" ), uno::makeAny( sal_True ) ); } void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) commit 75d38d0735f17549da5e4ec038f97478236c3048 Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Wed Nov 9 09:57:58 2011 +0100 sw: fixed the dbglevel>1 build: GetBuffer() -> getStr() diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 12edea0..d595b51 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -106,15 +106,15 @@ SW_DLLPUBLIC const char * dbg_out(const String & aStr) aDbgOutResult = rtl::OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US); if (bDbgOutStdErr) - fprintf(stderr, "%s", aDbgOutResult.GetBuffer()); + fprintf(stderr, "%s", aDbgOutResult.getStr()); - return aDbgOutResult.GetBuffer(); + return aDbgOutResult.getStr(); } SW_DLLPUBLIC const char * dbg_out(const ::rtl::OUString & aStr) { aDbgOutResult = rtl::OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US); - return aDbgOutResult.GetBuffer(); + return aDbgOutResult.getStr(); }
_______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits