[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source writerfilter/source
LuboÅ¡ LuÅák
l.lunak at suse.cz
Tue Aug 6 08:18:19 PDT 2013
sw/inc/IDocumentSettingAccess.hxx | 2 ++
sw/inc/doc.hxx | 1 +
sw/inc/fmtsrndenum.hxx | 16 +++++++++-------
sw/source/core/doc/doc.cxx | 5 +++++
sw/source/core/doc/docnew.cxx | 1 +
sw/source/core/text/txtfly.cxx | 10 ++++++++--
sw/source/filter/ww8/ww8par.cxx | 1 +
sw/source/ui/uno/SwXDocumentSettings.cxx | 14 ++++++++++++++
writerfilter/source/dmapper/DomainMapper.cxx | 3 +++
writerfilter/source/dmapper/PropertyIds.cxx | 1 +
writerfilter/source/dmapper/PropertyIds.hxx | 1 +
11 files changed, 46 insertions(+), 9 deletions(-)
New commits:
commit 8f8b31abd02876c3601e343b8b3274754f8a61b6
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue Aug 6 17:02:42 2013 +0200
compatibility setting for MS Word wrapping text in less space (bnc#822908)
The document itself is stupid and uses a SURROUND_THROUGH object with a number
of empty lines that make it act is if it in fact was SURROUND_NONE, rather
than actually disabling wrapping for the object and be done with it.
But the difference was that Word still managed to fit those empty lines
next to the object into the little space that was there, while LO already
considered the space too small. So keep a compatibility setting for Word
documents in order to avoid problems with such lame documents and hopefully
that's enough.
Change-Id: I7d17b90de381fd86914ce5efd9c5a29fe4850edc
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 1203915..73c14f9 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -77,6 +77,8 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd
CLIPPED_PICTURES,
BACKGROUND_PARA_OVER_DRAWINGS,
TAB_OVER_MARGIN,
+ // MS Word still wraps text around objects with less space than LO would.
+ SURROUND_TEXT_WRAP_SMALL,
// COMPATIBILITY FLAGS END
BROWSE_MODE,
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index b032324..0c99352 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -582,6 +582,7 @@ private:
bool mbClippedPictures;
bool mbBackgroundParaOverDrawings;
bool mbTabOverMargin;
+ bool mbSurroundTextWrapSmall;
bool mbLastBrowseMode : 1;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index b686986..7b0ff63 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -192,6 +192,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
case CLIPPED_PICTURES: return mbClippedPictures;
case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings;
case TAB_OVER_MARGIN: return mbTabOverMargin;
+ case SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall;
case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked!
case HTML_MODE: return mbHTMLMode;
@@ -348,6 +349,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
mbTabOverMargin = value;
break;
+ case SURROUND_TEXT_WRAP_SMALL:
+ mbSurroundTextWrapSmall = 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 03aaf1c..ea75fd0 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -312,6 +312,7 @@ SwDoc::SwDoc()
mbClippedPictures(false),
mbBackgroundParaOverDrawings(false),
mbTabOverMargin(false),
+ mbSurroundTextWrapSmall(false),
mbLastBrowseMode( false ),
mn32DummyCompatabilityOptions1(0),
mn32DummyCompatabilityOptions2(0),
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 54635d7..65bf05e 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -1342,6 +1342,9 @@ SwRect SwTxtFly::AnchoredObjToRect( const SwAnchoredObject* pAnchoredObj,
// Wrap only on sides with at least 2cm space for the text
#define TEXT_MIN 1134
+// MS Word wraps on sides with even less space (value guessed).
+#define TEXT_MIN_SMALL 300
+
// Wrap on both sides up to a frame width of 1.5cm
#define FRAME_MAX 850
@@ -1398,9 +1401,12 @@ SwSurround SwTxtFly::_GetSurroundForTextWrap( const SwAnchoredObject* pAnchoredO
else
nRight = 0;
}
- if( nLeft < TEXT_MIN )
+ const int textMin = GetMaster()->GetNode()
+ ->getIDocumentSettingAccess()->get(IDocumentSettingAccess::SURROUND_TEXT_WRAP_SMALL )
+ ? TEXT_MIN_SMALL : TEXT_MIN;
+ if( nLeft < textMin )
nLeft = 0;
- if( nRight < TEXT_MIN )
+ if( nRight < textMin )
nRight = 0;
if( nLeft )
eSurroundForTextWrap = nRight ? SURROUND_PARALLEL : SURROUND_LEFT;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index f50eae5..5382435 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1585,6 +1585,7 @@ void SwWW8ImplReader::ImportDop()
rDoc.set(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS, true);
rDoc.set(IDocumentSettingAccess::CLIPPED_PICTURES, true);
rDoc.set(IDocumentSettingAccess::TAB_OVER_MARGIN, true);
+ rDoc.set(IDocumentSettingAccess::SURROUND_TEXT_WRAP_SMALL, true);
//
// COMPATIBILITY FLAGS END
diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx
index 88af1dd..11d1859 100644
--- a/sw/source/ui/uno/SwXDocumentSettings.cxx
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -123,6 +123,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_EMBED_FONTS,
HANDLE_EMBED_SYSTEM_FONTS,
HANDLE_TAB_OVER_MARGIN,
+ HANDLE_SURROUND_TEXT_WRAP_SMALL
};
static MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -192,6 +193,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ RTL_CONSTASCII_STRINGPARAM("EmbedFonts"), HANDLE_EMBED_FONTS, CPPUTYPE_BOOLEAN, 0, 0},
{ RTL_CONSTASCII_STRINGPARAM("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, CPPUTYPE_BOOLEAN, 0, 0},
{ RTL_CONSTASCII_STRINGPARAM("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, 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
@@ -789,6 +791,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
mpDoc->set(IDocumentSettingAccess::TAB_OVER_MARGIN, bTmp);
}
break;
+ case HANDLE_SURROUND_TEXT_WRAP_SMALL:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::SURROUND_TEXT_WRAP_SMALL, bTmp);
+ }
+ break;
default:
throw UnknownPropertyException();
}
@@ -1203,6 +1211,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue.setValue( &bTmp, ::getBooleanCppuType() );
}
break;
+ case HANDLE_SURROUND_TEXT_WRAP_SMALL:
+ {
+ sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::SURROUND_TEXT_WRAP_SMALL );
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
default:
throw UnknownPropertyException();
}
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index cab21d8..ee863fa 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -100,6 +100,9 @@ LoggedStream(dmapper_logger, "DomainMapper"),
m_pImpl->SetDocumentSettingsProperty(
PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_TABS_RELATIVE_TO_INDENT ),
uno::makeAny( false ) );
+ m_pImpl->SetDocumentSettingsProperty(
+ PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_SURROUND_TEXT_WRAP_SMALL ),
+ uno::makeAny( true ) );
//import document properties
try
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 1d62f00..cee68ea 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -329,6 +329,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_LABEL_CATEGORY: sName = "LabelCategory"; break;
case PROP_FIRST_IS_SHARED : sName = "FirstIsShared"; break;
case PROP_MIRROR_INDENTS : sName = "MirrorIndents"; break;
+ case PROP_SURROUND_TEXT_WRAP_SMALL: sName = "SurroundTextWrapSmall"; break;
}
::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index 19ee4ff..2a6b764 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -300,6 +300,7 @@ enum PropertyIds
,PROP_CHAR_SHADING_VALUE
,PROP_FIRST_IS_SHARED
,PROP_MIRROR_INDENTS
+ ,PROP_SURROUND_TEXT_WRAP_SMALL
};
struct PropertyNameSupplier_Impl;
class PropertyNameSupplier
commit 1b6cad89690a1188c6628c68d62108866b837779
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue Aug 6 15:09:31 2013 +0200
make it obvious that SwSurround and css::text::WrapTextMode are the same
Change-Id: I20154c12b9406b7ea2f8f245aa688859118982f7
diff --git a/sw/inc/fmtsrndenum.hxx b/sw/inc/fmtsrndenum.hxx
index f85d003..13661fc 100644
--- a/sw/inc/fmtsrndenum.hxx
+++ b/sw/inc/fmtsrndenum.hxx
@@ -19,14 +19,16 @@
#ifndef _FMTSRNDENUM_HXX
#define _FMTSRNDENUM_HXX
+#include <com/sun/star/text/WrapTextMode.hpp>
+
enum SwSurround {
- SURROUND_BEGIN,
- SURROUND_NONE = SURROUND_BEGIN,
- SURROUND_THROUGHT,
- SURROUND_PARALLEL,
- SURROUND_IDEAL,
- SURROUND_LEFT,
- SURROUND_RIGHT,
+ SURROUND_NONE = com::sun::star::text::WrapTextMode_NONE,
+ SURROUND_BEGIN = SURROUND_NONE,
+ SURROUND_THROUGHT = com::sun::star::text::WrapTextMode_THROUGHT,
+ SURROUND_PARALLEL = com::sun::star::text::WrapTextMode_PARALLEL,
+ SURROUND_IDEAL = com::sun::star::text::WrapTextMode_DYNAMIC,
+ SURROUND_LEFT = com::sun::star::text::WrapTextMode_LEFT,
+ SURROUND_RIGHT = com::sun::star::text::WrapTextMode_RIGHT,
SURROUND_END
};
More information about the Libreoffice-commits
mailing list