[Libreoffice-commits] core.git: 2 commits - include/unotools officecfg/registry sw/inc sw/source sw/uiconfig unotools/source

Miklos Vajna vmiklos at collabora.co.uk
Fri May 26 21:17:31 UTC 2017


 include/unotools/compatibility.hxx                                |    1 
 officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs |    6 ++
 sw/inc/viewsh.hxx                                                 |    2 
 sw/source/core/layout/paintfrm.cxx                                |   21 ++++++++--
 sw/source/core/view/viewsh.cxx                                    |    6 ++
 sw/source/ui/config/optcomp.cxx                                   |   16 ++++++-
 sw/uiconfig/swriter/ui/optcompatpage.ui                           |    1 
 unotools/source/config/compatibility.cxx                          |    4 +
 8 files changed, 50 insertions(+), 7 deletions(-)

New commits:
commit f85ded43446b17fbfdd868cc057ba39666d3d7cb
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri May 26 18:13:54 2017 +0200

    tdf#108056 sw: add UI to disable SubtractFlysAnchoredAtFlys compat option
    
    There is a reason this is off by default, make it a bit more easier for
    users to not depend this option when they don't actually need it.
    
    Change-Id: I21c5b942c6021fa21840779e1a9f53055fbf279f
    Reviewed-on: https://gerrit.libreoffice.org/38081
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/include/unotools/compatibility.hxx b/include/unotools/compatibility.hxx
index defbabdf8563..5a4e2f7922ef 100644
--- a/include/unotools/compatibility.hxx
+++ b/include/unotools/compatibility.hxx
@@ -59,6 +59,7 @@ class UNOTOOLS_DLLPUBLIC SvtCompatibilityEntry
             ExpandWordSpace,
             ProtectForm,
             MsWordTrailingBlanks,
+            SubtractFlysAnchoredAtFlys,
 
             /* Should be at the end. Do not remove it. */
             INVALID
diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
index 90394f22dafe..f71c66205871 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
@@ -116,6 +116,12 @@
         </info>
         <value>false</value>
       </prop>
+      <prop oor:name="SubtractFlysAnchoredAtFlys" oor:type="xs:boolean" oor:nillable="false">
+        <info>
+          <desc>Use LibreOffice 4.3 anchoring paint order</desc>
+        </info>
+        <value>false</value>
+      </prop>
     </group>
   </templates>
   <component>
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 17fe5f6f2c9f..1678e26eea3e 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -418,6 +418,8 @@ public:
 
     void SetMsWordCompTrailingBlanks( bool _bMsWordCompTrailingBlanks );
 
+    void SetSubtractFlysAnchoredAtFlys(bool bSubtractFlysAnchoredAtFlys);
+
     // DOCUMENT COMPATIBILITY FLAGS END
 
     // Calls Idle-formatter of Layout.
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 8ce4de7d028c..7cbcd8b4a689 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -917,6 +917,12 @@ void SwViewShell::SetMsWordCompTrailingBlanks( bool _bMsWordCompTrailingBlanks )
     }
 }
 
+void SwViewShell::SetSubtractFlysAnchoredAtFlys(bool bSubtractFlysAnchoredAtFlys)
+{
+    IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess();
+    rIDSA.set(DocumentSettingId::SUBTRACT_FLYS, bSubtractFlysAnchoredAtFlys);
+}
+
 void SwViewShell::Reformat()
 {
     SwWait aWait( *GetDoc()->GetDocShell(), true );
diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
index 3dc5d377ace0..4feaf12b3684 100644
--- a/sw/source/ui/config/optcomp.cxx
+++ b/sw/source/ui/config/optcomp.cxx
@@ -114,7 +114,8 @@ sal_uLong convertBools2Ulong_Impl
     bool _bConsiderWrappingStyle,
     bool _bExpandWordSpace,
     bool _bProtectForm,
-    bool _bMsWordCompTrailingBlanks
+    bool _bMsWordCompTrailingBlanks,
+    bool bSubtractFlysAnchoredAtFlys
 )
 {
     sal_uLong nRet = 0;
@@ -158,6 +159,9 @@ sal_uLong convertBools2Ulong_Impl
     nSetBit = nSetBit << 1;
     if ( _bMsWordCompTrailingBlanks )
         nRet |= nSetBit;
+    nSetBit = nSetBit << 1;
+    if (bSubtractFlysAnchoredAtFlys)
+        nRet |= nSetBit;
 
     return nRet;
 }
@@ -241,7 +245,8 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
             aEntry.getValue<bool>( SvtCompatibilityEntry::Index::ConsiderWrappingStyle ),
             aEntry.getValue<bool>( SvtCompatibilityEntry::Index::ExpandWordSpace ),
             aEntry.getValue<bool>( SvtCompatibilityEntry::Index::ProtectForm ),
-            aEntry.getValue<bool>( SvtCompatibilityEntry::Index::MsWordTrailingBlanks ) );
+            aEntry.getValue<bool>( SvtCompatibilityEntry::Index::MsWordTrailingBlanks ),
+            aEntry.getValue<bool>( SvtCompatibilityEntry::Index::SubtractFlysAnchoredAtFlys ) );
         m_pFormattingLB->SetEntryData( nPos, reinterpret_cast<void*>((sal_IntPtr)nOptions) );
     }
 
@@ -313,7 +318,8 @@ sal_uLong SwCompatibilityOptPage::GetDocumentOptions() const
             rIDocumentSettingAccess.get( DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION ),
             !rIDocumentSettingAccess.get( DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK ),
             rIDocumentSettingAccess.get( DocumentSettingId::PROTECT_FORM ),
-            rIDocumentSettingAccess.get( DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS ) );
+            rIDocumentSettingAccess.get( DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS ),
+            rIDocumentSettingAccess.get( DocumentSettingId::SUBTRACT_FLYS ) );
     }
     return nRet;
 }
@@ -401,6 +407,10 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet*  )
                         m_pWrtShell->SetMsWordCompTrailingBlanks( bChecked );
                         break;
 
+                    case SvtCompatibilityEntry::Index::SubtractFlysAnchoredAtFlys:
+                        m_pWrtShell->SetSubtractFlysAnchoredAtFlys(bChecked);
+                        break;
+
                     default:
                         break;
                 }
diff --git a/sw/uiconfig/swriter/ui/optcompatpage.ui b/sw/uiconfig/swriter/ui/optcompatpage.ui
index 3c2eb9330dae..c391925553bf 100644
--- a/sw/uiconfig/swriter/ui/optcompatpage.ui
+++ b/sw/uiconfig/swriter/ui/optcompatpage.ui
@@ -66,6 +66,7 @@
                       <item translatable="yes">Expand word space on lines with manual line breaks in justified paragraphs</item>
                       <item translatable="yes">Protect form</item>
                       <item translatable="yes">MS Word-compatible trailing blanks</item>
+                      <item translatable="yes">Use LibreOffice 4.3 anchoring paint order (in current document)</item>
                       <item translatable="yes"><User settings></item>
                     </items>
                   </object>
diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx
index 91b3e53e5929..bea5cb841a3b 100644
--- a/unotools/source/config/compatibility.cxx
+++ b/unotools/source/config/compatibility.cxx
@@ -61,6 +61,7 @@ SvtCompatibilityEntry::SvtCompatibilityEntry()
     setValue<bool>( Index::ExpandWordSpace, true );
     setValue<bool>( Index::ProtectForm, false );
     setValue<bool>( Index::MsWordTrailingBlanks, false );
+    setValue<bool>( Index::SubtractFlysAnchoredAtFlys, false );
 
     setDefaultEntry( false );
 }
@@ -90,7 +91,8 @@ OUString SvtCompatibilityEntry::getName( const Index rIdx )
         "ConsiderWrappingStyle",
         "ExpandWordSpace",
         "ProtectForm",
-        "MsWordCompTrailingBlanks"
+        "MsWordCompTrailingBlanks",
+        "SubtractFlysAnchoredAtFlys"
     };
 
     /* Size of sPropertyName array not equal size of the SvtCompatibilityEntry::Index enum class */
commit 0714d2f3009bbb24501561c1a8e96a6feb9a42ca
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri May 26 17:27:15 2017 +0200

    tdf#108056 sw SubtractFlys: add missing expansion of the clip path
    
    With this finally the bugdoc has no more unexpected white lines around
    the fly frame. In the non-SubtractFlys case DrawFillAttributes() already
    did an expansion of the clip path, but this was overwritten in case the
    layout flag was set.
    
    Fix the problem by taking care of this in lcl_SubtractFlys() itself.
    
    Change-Id: Iac91279f8bc19588e763425aff5cb800e793da83
    Reviewed-on: https://gerrit.libreoffice.org/38079
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index bb6ca5a7e2eb..008e26f9efef 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1532,6 +1532,21 @@ static void lcl_ExtendLeftAndRight( SwRect&                _rRect,
     }
 }
 
+/// Returns a range suitable for subtraction when lcl_SubtractFlys() is used.
+/// Otherwise DrawFillAttributes() expands the clip path itself.
+static basegfx::B2DRange lcl_ShrinkFly(const SwRect& rRect)
+{
+    static MapMode aMapMode(MapUnit::MapTwip);
+    static const Size aSingleUnit = Application::GetDefaultDevice()->PixelToLogic(Size(1, 1), aMapMode);
+
+    double x1 = rRect.Left() + aSingleUnit.getWidth();
+    double y1 = rRect.Top() + aSingleUnit.getHeight();
+    double x2 = rRect.Right() - aSingleUnit.getWidth();
+    double y2 = rRect.Bottom() - aSingleUnit.getHeight();
+
+    return basegfx::B2DRange(x1, y1, x2, y2);
+}
+
 static void lcl_SubtractFlys( const SwFrame *pFrame, const SwPageFrame *pPage,
    const SwRect &rRect, SwRegionRects &rRegion, basegfx::tools::B2DClipState& rClipState, SwPaintProperties & rProperties)
 {
@@ -1666,7 +1681,7 @@ static void lcl_SubtractFlys( const SwFrame *pFrame, const SwPageFrame *pPage,
                 const SwBorderAttrs &rAttrs = *aAccess.Get();
                 ::lcl_CalcBorderRect( aRect, pFly, rAttrs, true, rProperties );
                 rRegion -= aRect;
-                rClipState.subtractRange(basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()));
+                rClipState.subtractRange(lcl_ShrinkFly(aRect));
                 continue;
             }
             else
@@ -1684,14 +1699,14 @@ static void lcl_SubtractFlys( const SwFrame *pFrame, const SwPageFrame *pPage,
             const SwBorderAttrs &rAttrs = *aAccess.Get();
             ::lcl_CalcBorderRect( aRect, pFly, rAttrs, true, rProperties );
             rRegion -= aRect;
-            rClipState.subtractRange(basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()));
+            rClipState.subtractRange(lcl_ShrinkFly(aRect));
         }
         else
         {
             SwRect aRect( pFly->Prt() );
             aRect += pFly->Frame().Pos();
             rRegion -= aRect;
-            rClipState.subtractRange(basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()));
+            rClipState.subtractRange(lcl_ShrinkFly(aRect));
         }
     }
     if (gProp.pSRetoucheFly == gProp.pSRetoucheFly2)


More information about the Libreoffice-commits mailing list