summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-01-08 11:57:13 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-01-08 14:17:27 +0100
commitbdfc6363d66aa079512cc8008996b633f693fed1 (patch)
tree7704817a991ba16b2437381506a7360a2cb741cc
parentf7623118c415581434937f31f4c56d38a9d02286 (diff)
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.
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx1
-rw-r--r--sw/inc/doc.hxx1
-rw-r--r--sw/source/core/doc/doc.cxx5
-rw-r--r--sw/source/core/doc/docnew.cxx1
-rw-r--r--sw/source/core/text/txttab.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par.cxx1
-rw-r--r--sw/source/filter/xml/xmlimp.cxx7
-rw-r--r--sw/source/ui/uno/SwXDocumentSettings.cxx16
-rw-r--r--writerfilter/source/filter/ImportFilter.cxx1
9 files changed, 36 insertions, 2 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 2c02236f8338..8214f1abf282 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -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,
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index ef40d44cf591..c67f79fb8ce6 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -578,6 +578,7 @@ private:
bool mbUnbreakableNumberings;
bool mbClippedPictures;
bool mbBackgroundParaOverDrawings;
+ bool mbTabOverMargin;
bool mbLastBrowseMode : 1;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index dda0b6dce46e..80cfa846fd4d 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 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
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index cb3bc9c8c6b2..949cab186a13 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -317,6 +317,7 @@ SwDoc::SwDoc()
mbUnbreakableNumberings(false),
mbClippedPictures(false),
mbBackgroundParaOverDrawings(false),
+ mbTabOverMargin(false),
mbLastBrowseMode( false ),
n32DummyCompatabilityOptions1(0),
n32DummyCompatabilityOptions2(0),
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 4395d5563d59..c6eda0a7f6d3 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -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;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 0db2f7f491f1..7705aae2cb37 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -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
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index d085eb87834a..a86364b4d50e 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -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);
diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx
index ede40fd2b794..828b6037e763 100644
--- a/sw/source/ui/uno/SwXDocumentSettings.cxx
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -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();
}
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx
index d58e87725178..e56cbca4dff6 100644
--- a/writerfilter/source/filter/ImportFilter.cxx
+++ b/writerfilter/source/filter/ImportFilter.cxx
@@ -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 )