Kaydet (Commit) bdfc6363 authored tarafından Miklos Vajna's avatar Miklos Vajna

n#793998 sw: add TabOverMargin compat mode

In case the right margin is larger then the tab position (e.g. the right
margin of 7cm, there is a tab position at 16cm and right margin begins
at 9cm), we have a conflicting case.  In Word, the tab has priority, so
in this conflicting case, the text can be outside the specified margin.
In Writer, the right margin has priority. Add a compat flag to let
the tab have priority in Writer as well for Word formats.

This is similar to TabOverflow, but that was only applied to left tabs
and only in case there were no characters after the tabs in the
paragraph.
üst f7623118
......@@ -77,6 +77,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd
UNBREAKABLE_NUMBERINGS,
CLIPPED_PICTURES,
BACKGROUND_PARA_OVER_DRAWINGS,
TAB_OVER_MARGIN,
// COMPATIBILITY FLAGS END
BROWSE_MODE,
......
......@@ -578,6 +578,7 @@ private:
bool mbUnbreakableNumberings;
bool mbClippedPictures;
bool mbBackgroundParaOverDrawings;
bool mbTabOverMargin;
bool mbLastBrowseMode : 1;
......
......@@ -192,6 +192,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
case UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings;
case CLIPPED_PICTURES: return mbClippedPictures;
case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings;
case TAB_OVER_MARGIN: return mbTabOverMargin;
case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked!
case HTML_MODE: return mbHTMLMode;
......@@ -347,6 +348,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
mbBackgroundParaOverDrawings = value;
break;
case TAB_OVER_MARGIN:
mbTabOverMargin = value;
break;
// COMPATIBILITY FLAGS END
case BROWSE_MODE: //can be used temporary (load/save) when no ViewShell is avaiable
......
......@@ -317,6 +317,7 @@ SwDoc::SwDoc()
mbUnbreakableNumberings(false),
mbClippedPictures(false),
mbBackgroundParaOverDrawings(false),
mbTabOverMargin(false),
mbLastBrowseMode( false ),
n32DummyCompatabilityOptions1(0),
n32DummyCompatabilityOptions2(0),
......
......@@ -486,7 +486,10 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf )
sal_Bool SwTabPortion::PostFormat( SwTxtFormatInfo &rInf )
{
const KSHORT nRight = Min( GetTabPos(), rInf.Width() );
const bool bTabOverMargin = rInf.GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_OVER_MARGIN);
// If the tab position is larger than the right margin, it gets scaled down by default.
// However, if compat mode enabled, we allow tabs to go over the margin: the rest of the paragraph is not broken into lines.
const KSHORT nRight = bTabOverMargin ? GetTabPos() : Min(GetTabPos(), rInf.Width());
const SwLinePortion *pPor = GetPortion();
KSHORT nPorWidth = 0;
......
......@@ -1545,6 +1545,7 @@ void SwWW8ImplReader::ImportDop()
rDoc.set(IDocumentSettingAccess::TAB_OVERFLOW, true);
rDoc.set(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS, true);
rDoc.set(IDocumentSettingAccess::CLIPPED_PICTURES, true);
rDoc.set(IDocumentSettingAccess::TAB_OVER_MARGIN, true);
//
// COMPATIBILITY FLAGS END
......
......@@ -1144,6 +1144,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
aSet.insert(String("UnbreakableNumberings", RTL_TEXTENCODING_ASCII_US));
aSet.insert(String("ClippedPictures", RTL_TEXTENCODING_ASCII_US));
aSet.insert(String("BackgroundParaOverDrawings", RTL_TEXTENCODING_ASCII_US));
aSet.insert(String("TabOverMargin", RTL_TEXTENCODING_ASCII_US));
sal_Int32 nCount = aConfigProps.getLength();
const PropertyValue* pValues = aConfigProps.getConstArray();
......@@ -1177,6 +1178,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
bool bUnbreakableNumberings = false;
bool bClippedPictures = false;
bool bBackgroundParaOverDrawings = false;
bool bTabOverMargin = false;
OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) );
......@@ -1269,6 +1271,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
bClippedPictures = true;
else if ( pValues->Name == "BackgroundParaOverDrawings" )
bBackgroundParaOverDrawings = true;
else if ( pValues->Name == "TabOverMargin" )
bTabOverMargin = true;
}
catch( Exception& )
{
......@@ -1456,6 +1460,9 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
if ( !bBackgroundParaOverDrawings )
xProps->setPropertyValue("BackgroundParaOverDrawings", makeAny( false ) );
if ( !bTabOverMargin )
xProps->setPropertyValue("TabOverMargin", makeAny( false ) );
Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
Reference < XText > xText = xTextDoc->getText();
Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
......
......@@ -122,7 +122,8 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_CLIPPED_PICTURES,
HANDLE_BACKGROUND_PARA_OVER_DRAWINGS,
HANDLE_EMBED_FONTS,
HANDLE_EMBED_SYSTEM_FONTS
HANDLE_EMBED_SYSTEM_FONTS,
HANDLE_TAB_OVER_MARGIN,
};
static MasterPropertySetInfo * lcl_createSettingsInfo()
......@@ -191,6 +192,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ RTL_CONSTASCII_STRINGPARAM("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, CPPUTYPE_BOOLEAN, 0, 0},
{ 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},
/*
* 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
......@@ -785,6 +787,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
mpDoc->set(IDocumentSettingAccess::EMBED_SYSTEM_FONTS, bTmp);
}
break;
case HANDLE_TAB_OVER_MARGIN:
{
sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
mpDoc->set(IDocumentSettingAccess::TAB_OVER_MARGIN, bTmp);
}
break;
default:
throw UnknownPropertyException();
}
......@@ -1192,6 +1200,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue.setValue( &bTmp, ::getBooleanCppuType() );
}
break;
case HANDLE_TAB_OVER_MARGIN:
{
sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::TAB_OVER_MARGIN );
rValue.setValue( &bTmp, ::getBooleanCppuType() );
}
break;
default:
throw UnknownPropertyException();
}
......
......@@ -192,6 +192,7 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >&
xSettings->setPropertyValue("FloattableNomargins", uno::makeAny( sal_True ));
xSettings->setPropertyValue( "ClippedPictures", uno::makeAny( sal_True ) );
xSettings->setPropertyValue( "BackgroundParaOverDrawings", uno::makeAny( sal_True ) );
xSettings->setPropertyValue( "TabOverMargin", uno::makeAny( sal_True ) );
}
void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment