merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0550-sw-invert-border-spacing.diff
blob4f77171f69b6e95c8ad273d1a6639c0ba372381b
1 diff --git sw/inc/IDocumentSettingAccess.hxx sw/inc/IDocumentSettingAccess.hxx
2 index cebdfcd..b7b683f 100644
3 --- sw/inc/IDocumentSettingAccess.hxx
4 +++ sw/inc/IDocumentSettingAccess.hxx
5 @@ -84,6 +84,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd
6 // --> OD 2008-06-05 #i89181#
7 TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
8 // <--
9 + INVERT_BORDER_SPACING,
10 // COMPATIBILITY FLAGS END
12 BROWSE_MODE,
13 diff --git sw/inc/doc.hxx sw/inc/doc.hxx
14 index 25de567..5ee662e 100644
15 --- sw/inc/doc.hxx
16 +++ sw/inc/doc.hxx
17 @@ -609,6 +609,7 @@ private:
18 bool mbOldPrinterMetrics : 1; // FME 2007-05-14 #147385#
19 bool mbTabRelativeToIndent : 1; // #i24363# tab stops relative to indent
20 bool mbProtectForm : 1;
21 + bool mbInvertBorderSpacing : 1;
22 bool mbTabAtLeftIndentForParagraphsInList; // OD 2008-06-05 #i89181# - see above
24 // #i78591#
25 diff --git sw/source/core/doc/doc.cxx sw/source/core/doc/doc.cxx
26 index 4c7ad45..24f5ef4 100644
27 --- sw/source/core/doc/doc.cxx
28 +++ sw/source/core/doc/doc.cxx
29 @@ -184,6 +184,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
30 // --> OD 2008-06-05 #i89181#
31 case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return mbTabAtLeftIndentForParagraphsInList;
32 // <--
33 + case INVERT_BORDER_SPACING: return mbInvertBorderSpacing;
34 // COMPATIBILITY FLAGS END
36 case BROWSE_MODE: return mbBrowseMode;
37 @@ -307,6 +308,9 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
38 mbTabAtLeftIndentForParagraphsInList = value;
39 break;
40 // <--
41 + case INVERT_BORDER_SPACING:
42 + mbInvertBorderSpacing = value;
43 + break;
44 // COMPATIBILITY FLAGS END
46 case BROWSE_MODE:
47 diff --git sw/source/core/doc/docnew.cxx sw/source/core/doc/docnew.cxx
48 index f7bc2c5..19cda11 100644
49 --- sw/source/core/doc/docnew.cxx
50 +++ sw/source/core/doc/docnew.cxx
51 @@ -379,6 +379,7 @@ SwDoc::SwDoc() :
52 // --> OD 2008-06-05 #i89181#
53 mbTabAtLeftIndentForParagraphsInList = false; // hidden
54 // <--
55 + mbInvertBorderSpacing = false; // hidden
58 // COMPATIBILITY FLAGS END
59 diff --git sw/source/core/layout/frmtool.cxx sw/source/core/layout/frmtool.cxx
60 index 5354200..21fdf63 100644
61 --- sw/source/core/layout/frmtool.cxx
62 +++ sw/source/core/layout/frmtool.cxx
63 @@ -2000,20 +2000,22 @@ void SwBorderAttrs::_CalcBottom()
65 long SwBorderAttrs::CalcRight( const SwFrm* pCaller ) const
67 - long nRight;
68 + long nRight=0;
70 - // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
71 - // and right border are painted on the right respectively left.
72 - if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() )
73 - nRight = CalcLeftLine();
74 - else
75 - nRight = CalcRightLine();
77 - // for paragraphs, "left" is "before text" and "right" is "after text"
78 - if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() )
79 - nRight += rLR.GetLeft();
80 - else
81 - nRight += rLR.GetRight();
82 + if (!pCaller->IsTxtFrm() || !((SwTxtFrm*)pCaller)->GetTxtNode()->GetDoc()->get(IDocumentSettingAccess::INVERT_BORDER_SPACING)) {
83 + // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
84 + // and right border are painted on the right respectively left.
85 + if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() )
86 + nRight = CalcLeftLine();
87 + else
88 + nRight = CalcRightLine();
90 + }
91 + // for paragraphs, "left" is "before text" and "right" is "after text"
92 + if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() )
93 + nRight += rLR.GetLeft();
94 + else
95 + nRight += rLR.GetRight();
97 // --> OD 2008-01-21 #newlistlevelattrs#
98 // correction: retrieve left margin for numbering in R2L-layout
99 @@ -2028,20 +2030,23 @@ long SwBorderAttrs::CalcRight( const SwFrm* pCaller ) const
101 long SwBorderAttrs::CalcLeft( const SwFrm *pCaller ) const
103 - long nLeft;
104 + long nLeft=0;
106 - // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
107 - // and right border are painted on the right respectively left.
108 - if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() )
109 - nLeft = CalcRightLine();
110 - else
111 - nLeft = CalcLeftLine();
113 - // for paragraphs, "left" is "before text" and "right" is "after text"
114 - if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() )
115 - nLeft += rLR.GetRight();
116 - else
117 - nLeft += rLR.GetLeft();
118 + if (!pCaller->IsTxtFrm() || !((SwTxtFrm*)pCaller)->GetTxtNode()->GetDoc()->get(IDocumentSettingAccess::INVERT_BORDER_SPACING)) {
119 + // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
120 + // and right border are painted on the right respectively left.
121 + if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() )
122 + nLeft = CalcRightLine();
123 + else
124 + nLeft = CalcLeftLine();
127 + // for paragraphs, "left" is "before text" and "right" is "after text"
128 + if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() )
129 + nLeft += rLR.GetRight();
130 + else
131 + nLeft += rLR.GetLeft();
134 // --> OD 2008-01-21 #newlistlevelattrs#
135 // correction: do not retrieve left margin for numbering in R2L-layout
136 diff --git sw/source/core/layout/paintfrm.cxx sw/source/core/layout/paintfrm.cxx
137 index a371990..2fed7f7 100644
138 --- sw/source/core/layout/paintfrm.cxx
139 +++ sw/source/core/layout/paintfrm.cxx
140 @@ -4650,7 +4650,7 @@ void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage,
141 const SwBorderAttrs &rAttrs ) const
143 //fuer (Row,Body,Ftn,Root,Column,NoTxt) gibt's hier nix zu tun
144 - if ( (GetType() & 0x90C5) || (Prt().SSize() == Frm().SSize()) )
145 + if ( (GetType() & 0x90C5) )
146 return;
148 if ( (GetType() & 0x2000) && //Cell
149 diff --git sw/source/filter/rtf/swparrtf.cxx sw/source/filter/rtf/swparrtf.cxx
150 index 4ee6616..c70eed1 100644
151 --- sw/source/filter/rtf/swparrtf.cxx
152 +++ sw/source/filter/rtf/swparrtf.cxx
153 @@ -309,7 +309,7 @@ void SwRTFParser::Continue( int nToken )
154 // --> FME 2006-02-10 #131283#
155 pDoc->set(IDocumentSettingAccess::TABLE_ROW_KEEP, true);
156 pDoc->set(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, true);
158 + pDoc->set(IDocumentSettingAccess::INVERT_BORDER_SPACING, true);
160 // COMPATIBILITY FLAGS END
162 diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
163 index 68be371..65da983 100644
164 --- sw/source/filter/ww8/ww8par.cxx
165 +++ sw/source/filter/ww8/ww8par.cxx
166 @@ -1538,6 +1538,8 @@ void SwWW8ImplReader::ImportDop()
167 rDoc.set(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, true);
168 // <--
170 + rDoc.set(IDocumentSettingAccess::INVERT_BORDER_SPACING, true);
173 // COMPATIBILITY FLAGS END
175 diff --git sw/source/filter/ww8/ww8par6.cxx sw/source/filter/ww8/ww8par6.cxx
176 index d762dfb..c15042a 100644
177 --- sw/source/filter/ww8/ww8par6.cxx
178 +++ sw/source/filter/ww8/ww8par6.cxx
179 @@ -4708,10 +4708,19 @@ void SwWW8ImplReader::Read_Border(USHORT , const BYTE* , short nLen)
181 maTracer.Log(sw::log::eBorderDistOutside);
183 - aBox.SetDistance( (USHORT)aInnerDist.Left(), BOX_LINE_LEFT );
184 - aBox.SetDistance( (USHORT)aInnerDist.Top(), BOX_LINE_TOP );
185 - aBox.SetDistance( (USHORT)aInnerDist.Right(), BOX_LINE_RIGHT );
186 - aBox.SetDistance( (USHORT)aInnerDist.Bottom(), BOX_LINE_BOTTOM );
187 + if ((nBorder & WW8_LEFT)==WW8_LEFT) {
188 + aBox.SetDistance( (USHORT)aInnerDist.Left(), BOX_LINE_LEFT );
190 + if ((nBorder & WW8_TOP)==WW8_TOP) {
191 + aBox.SetDistance( (USHORT)aInnerDist.Top(), BOX_LINE_TOP );
193 + if ((nBorder & WW8_RIGHT)==WW8_RIGHT) {
194 + aBox.SetDistance( (USHORT)aInnerDist.Right(), BOX_LINE_RIGHT );
197 + if ((nBorder & WW8_BOT)==WW8_BOT) {
198 + aBox.SetDistance( (USHORT)aInnerDist.Bottom(), BOX_LINE_BOTTOM );
201 NewAttr( aBox );
203 diff --git sw/source/ui/uno/SwXDocumentSettings.cxx sw/source/ui/uno/SwXDocumentSettings.cxx
204 index 70feea6..2ac36e6 100644
205 --- sw/source/ui/uno/SwXDocumentSettings.cxx
206 +++ sw/source/ui/uno/SwXDocumentSettings.cxx
207 @@ -131,6 +131,7 @@ enum SwDocumentSettingsPropertyHandles
208 // --> OD 2008-06-05 #i89181#
209 HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
210 // <--
211 + ,HANDLE_INVERT_BORDER_SPACING
214 MasterPropertySetInfo * lcl_createSettingsInfo()
215 @@ -184,7 +185,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo()
216 { RTL_CONSTASCII_STRINGPARAM("ProtectForm"), HANDLE_PROTECT_FORM, CPPUTYPE_BOOLEAN, 0, 0},
217 // --> OD 2008-06-05 #i89181#
218 { RTL_CONSTASCII_STRINGPARAM("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, CPPUTYPE_BOOLEAN, 0, 0},
220 + { RTL_CONSTASCII_STRINGPARAM("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, CPPUTYPE_BOOLEAN, 0, 0},
222 * As OS said, we don't have a view when we need to set this, so I have to
223 * find another solution before adding them to this property set - MTG
224 @@ -678,6 +679,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
226 break;
227 // <--
228 + case HANDLE_INVERT_BORDER_SPACING:
230 + sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
231 + mpDoc->set(IDocumentSettingAccess::INVERT_BORDER_SPACING, bTmp);
233 + break;
234 default:
235 throw UnknownPropertyException();
237 @@ -1005,7 +1012,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
239 break;
240 // <--
242 + case HANDLE_INVERT_BORDER_SPACING:
244 + sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::INVERT_BORDER_SPACING);
245 + rValue.setValue( &bTmp, ::getBooleanCppuType() );
247 + break;
248 default:
249 throw UnknownPropertyException();