kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0001-Resolves-fdo-36815-enable-printing-WYSIWYG-sidewindo.patch

f085be
From fd3cf8a32c58ee1b0f9d676cfb393478cf9b1ba2 Mon Sep 17 00:00:00 2001
f085be
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
f085be
Date: Tue, 15 Apr 2014 09:42:32 +0100
f085be
Subject: [PATCH] Resolves: fdo#36815 enable printing WYSIWYG sidewindow
f085be
 comments
f085be
f085be
in order for that to happen the document has to be scaled down
f085be
so that the comments outside the border of the sheet of paper
f085be
can be brought inside the printable area
f085be
f085be
Change-Id: Ifafb8eec10a4ea3ea0014097728888603e61e5a4
f085be
---
f085be
 sw/inc/PostItMgr.hxx                       |  3 ++
f085be
 sw/inc/SidebarWin.hxx                      |  1 +
f085be
 sw/inc/printdata.hxx                       |  1 +
f085be
 sw/source/core/layout/paintfrm.cxx         |  2 +-
f085be
 sw/source/core/view/printdata.cxx          |  7 ++--
f085be
 sw/source/core/view/vprint.cxx             | 49 ++++++++++++++++++++++++--
f085be
 sw/source/ui/config/optdlg.src             |  1 +
f085be
 sw/source/ui/config/optpage.cxx            |  7 ++++
f085be
 sw/source/ui/docvw/PostItMgr.cxx           | 16 +++++++++
f085be
 sw/source/ui/docvw/SidebarTxtControl.cxx   | 40 ++++++++++++++++++++++
f085be
 sw/source/ui/docvw/SidebarTxtControl.hxx   |  2 ++
f085be
 sw/source/ui/docvw/SidebarWin.cxx          | 55 ++++++++++++++++++++++++++++++
f085be
 sw/source/ui/inc/optpage.hxx               |  1 +
f085be
 sw/uiconfig/swriter/ui/printoptionspage.ui | 23 +++++++++++--
f085be
 14 files changed, 200 insertions(+), 8 deletions(-)
f085be
f085be
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
f085be
index 4c38d40..0ac0273 100644
f085be
--- a/sw/inc/PostItMgr.hxx
f085be
+++ b/sw/inc/PostItMgr.hxx
f085be
@@ -33,6 +33,7 @@
f085be
 #include <SidebarWindowsTypes.hxx>
f085be
 #include <svl/lstner.hxx>
f085be
 
f085be
+class OutputDevice;
f085be
 class SwWrtShell;
f085be
 class SwDoc;
f085be
 class SwView;
f085be
@@ -279,6 +280,8 @@ class SwPostItMgr: public SfxListener
f085be
                                                 const sal_Int32 nIndex );
f085be
             void GetAllSidebarWinForFrm( const SwFrm& rFrm,
f085be
                                          std::vector< Window* >* pChildren );
f085be
+
f085be
+            void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage);
f085be
 };
f085be
 
f085be
 #endif
f085be
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
f085be
index b3c4c82..5c8c527 100644
f085be
--- a/sw/inc/SidebarWin.hxx
f085be
+++ b/sw/inc/SidebarWin.hxx
f085be
@@ -163,6 +163,7 @@ class SwSidebarWin : public Window
f085be
 
f085be
         void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
f085be
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
f085be
+        virtual void    Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong);
f085be
 
f085be
     protected:
f085be
         virtual void    DataChanged( const DataChangedEvent& aEvent);
f085be
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
f085be
index b688608..b2f49b7 100644
f085be
--- a/sw/inc/printdata.hxx
f085be
+++ b/sw/inc/printdata.hxx
f085be
@@ -307,6 +307,7 @@ public:
f085be
 #define POSTITS_ONLY    1
f085be
 #define POSTITS_ENDDOC  2
f085be
 #define POSTITS_ENDPAGE 3
f085be
+#define POSTITS_INMARGINS 4
f085be
 
f085be
 namespace sw {
f085be
 
f085be
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
f085be
index 3e4ed87..2e88ef7 100644
f085be
--- a/sw/source/core/layout/paintfrm.cxx
f085be
+++ b/sw/source/core/layout/paintfrm.cxx
f085be
@@ -6213,7 +6213,7 @@ static void lcl_paintBitmapExToRect(OutputDevice *pOut, Point aPoint, BitmapEx&
f085be
     SwAlignRect( aPageRect, _pViewShell );
f085be
 
f085be
     const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr();
f085be
-    if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes())  // do not show anything in print preview
f085be
+    if (pMgr /*&& pMgr->ShowNotes()*/ && pMgr->HasNotes())  // do not show anything in print preview
f085be
     {
f085be
         sal_Int32 nScrollerHeight = pMgr->GetSidebarScrollerHeight();
f085be
         const Rectangle &aVisRect = _pViewShell->VisArea().SVRect();
f085be
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
f085be
index 192ae5a..b2e2ef5 100644
f085be
--- a/sw/source/core/view/printdata.cxx
f085be
+++ b/sw/source/core/view/printdata.cxx
f085be
@@ -172,8 +172,8 @@ SwPrintUIOptions::SwPrintUIOptions(
f085be
 {
f085be
     ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) );
f085be
 
f085be
-    OSL_ENSURE( aLocalizedStrings.Count() >= 30, "resource incomplete" );
f085be
-    if( aLocalizedStrings.Count() < 30 ) // bad resource ?
f085be
+    OSL_ENSURE( aLocalizedStrings.Count() >= 31, "resource incomplete" );
f085be
+    if( aLocalizedStrings.Count() < 31 ) // bad resource ?
f085be
         return;
f085be
 
f085be
     // printing HTML sources does not have any valid UI options.
f085be
@@ -322,11 +322,12 @@ SwPrintUIOptions::SwPrintUIOptions(
f085be
                                                            OUString(), aContentsOpt);
f085be
     // create a list box for notes content
f085be
     const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts();
f085be
-    aChoices.realloc( 4 );
f085be
+    aChoices.realloc( 5 );
f085be
     aChoices[0] = aLocalizedStrings.GetString( 13 );
f085be
     aChoices[1] = aLocalizedStrings.GetString( 14 );
f085be
     aChoices[2] = aLocalizedStrings.GetString( 15 );
f085be
     aChoices[3] = aLocalizedStrings.GetString( 16 );
f085be
+    aChoices[4] = aLocalizedStrings.GetString( 30 );
f085be
     aHelpIds.realloc( 2 );
f085be
     aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:FixedText";
f085be
     aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:ListBox";
f085be
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
f085be
index ff5ffb2..13c829b 100644
f085be
--- a/sw/source/core/view/vprint.cxx
f085be
+++ b/sw/source/core/view/vprint.cxx
f085be
@@ -69,6 +69,7 @@
f085be
 #include <viscrs.hxx>
f085be
 #include <fmtpdsc.hxx>
f085be
 #include <globals.hrc>
f085be
+#include "PostItMgr.hxx"
f085be
 
f085be
 using namespace ::com::sun::star;
f085be
 
f085be
@@ -454,13 +455,33 @@ sal_Bool SwViewShell::PrintOrPDFExport(
f085be
     // output device is now provided by a call from outside the Writer)
f085be
     pOutDev->Push();
f085be
 
f085be
+    // fdo#36815 for comments in margins print to a metafile
f085be
+    // and then scale that metafile down so that the comments
f085be
+    // will fit on the real page, and replay that scaled
f085be
+    // output to the real outputdevice
f085be
+    GDIMetaFile *pOrigRecorder(NULL);
f085be
+    GDIMetaFile *pMetaFile(NULL);
f085be
+    sal_Int16 nPostItMode = rPrintData.GetPrintPostIts();
f085be
+    if (nPostItMode == POSTITS_INMARGINS)
f085be
+    {
f085be
+        //get and disable the existing recorder
f085be
+        pOrigRecorder = pOutDev->GetConnectMetaFile();
f085be
+        pOutDev->SetConnectMetaFile(NULL);
f085be
+        // turn off output to the device
f085be
+        pOutDev->EnableOutput(false);
f085be
+        // just record the rendering commands to the metafile
f085be
+        // instead
f085be
+        pMetaFile = new GDIMetaFile;
f085be
+        pMetaFile->Record(pOutDev);
f085be
+    }
f085be
+
f085be
     // Print/PDF export for (multi-)selection has already generated a
f085be
     // temporary document with the selected text.
f085be
     // (see XRenderable implementation in unotxdoc.cxx)
f085be
     // It is implemented this way because PDF export calls this Prt function
f085be
     // once per page and we do not like to always have the temporary document
f085be
     // to be created that often here.
f085be
-    SwViewShell *pShell = new SwViewShell( *this, 0, pOutDev );
f085be
+    SwViewShell *pShell = new SwViewShell(*this, 0, pOutDev);
f085be
 
f085be
     SdrView *pDrawView = pShell->GetDrawView();
f085be
     if (pDrawView)
f085be
@@ -502,13 +523,37 @@ sal_Bool SwViewShell::PrintOrPDFExport(
f085be
 
f085be
         ::SetSwVisArea( pViewSh2, pStPage->Frm() );
f085be
 
f085be
-        pShell->InitPrt( pOutDev );
f085be
+        pShell->InitPrt(pOutDev);
f085be
 
f085be
         ::SetSwVisArea( pViewSh2, pStPage->Frm() );
f085be
 
f085be
         pStPage->GetUpper()->Paint( pStPage->Frm(), &rPrintData );
f085be
 
f085be
         SwPaintQueue::Repaint();
f085be
+
f085be
+        if (nPostItMode == POSTITS_INMARGINS)
f085be
+        {
f085be
+            SwPostItMgr *pPostItManager = pShell->GetPostItMgr();
f085be
+            pPostItManager->CalcRects();
f085be
+            pPostItManager->LayoutPostIts();
f085be
+            pPostItManager->DrawNotesForPage(pOutDev, nPage-1);
f085be
+
f085be
+            //Now scale the recorded page down so the notes
f085be
+            //will fit in the final page
f085be
+            pMetaFile->Stop();
f085be
+            pMetaFile->WindStart();
f085be
+            double fScale = 0.75;
f085be
+            pMetaFile->Scale( fScale, fScale );
f085be
+            pMetaFile->WindStart();
f085be
+
f085be
+            //Enable output the the device again
f085be
+            pOutDev->EnableOutput(true);
f085be
+            //Restore the original recorder
f085be
+            pOutDev->SetConnectMetaFile(pOrigRecorder);
f085be
+            //play back the scaled page
f085be
+            pMetaFile->Play(pOutDev);
f085be
+            delete pMetaFile;
f085be
+        }
f085be
     }
f085be
 
f085be
     delete pShell;
f085be
diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src
f085be
index 748560a..b5ae69c 100644
f085be
--- a/sw/source/ui/config/optdlg.src
f085be
+++ b/sw/source/ui/config/optdlg.src
f085be
@@ -71,6 +71,7 @@ StringArray STR_PRINTOPTUI
f085be
         < "~All pages"; >;
f085be
         < "Pa~ges"; >;
f085be
         < "~Selection"; >;
f085be
+        < "Place in margins"; >;
f085be
     };
f085be
 };
f085be
 
f085be
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
f085be
index d7efd53..4549402 100644
f085be
--- a/sw/source/ui/config/optpage.cxx
f085be
+++ b/sw/source/ui/config/optpage.cxx
f085be
@@ -312,6 +312,7 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(Window* pParent,
f085be
     get(m_pOnlyRB, "only");
f085be
     get(m_pEndRB, "end");
f085be
     get(m_pEndPageRB, "endpage");
f085be
+    get(m_pInMarginsRB, "inmargins");
f085be
     get(m_pPrintEmptyPagesCB, "blankpages");
f085be
     get(m_pPaperFromSetupCB, "papertray");
f085be
     get(m_pFaxLB, "fax");
f085be
@@ -332,6 +333,7 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(Window* pParent,
f085be
     m_pPaperFromSetupCB->SetClickHdl( aLk );
f085be
     m_pPrintEmptyPagesCB->SetClickHdl( aLk );
f085be
     m_pEndPageRB->SetClickHdl( aLk );
f085be
+    m_pInMarginsRB->SetClickHdl( aLk );
f085be
     m_pEndRB->SetClickHdl( aLk );
f085be
     m_pOnlyRB->SetClickHdl( aLk );
f085be
     m_pNoRB->SetClickHdl( aLk );
f085be
@@ -398,6 +400,8 @@ sal_Bool    SwAddPrinterTabPage::FillItemSet( SfxItemSet& rCoreSet )
f085be
                                                         POSTITS_ENDDOC;
f085be
         if (m_pEndPageRB->IsChecked()) aAddPrinterAttr.nPrintPostIts =
f085be
                                                         POSTITS_ENDPAGE;
f085be
+        if (m_pInMarginsRB->IsChecked()) aAddPrinterAttr.nPrintPostIts =
f085be
+                                                        POSTITS_INMARGINS;
f085be
 
f085be
         OUString sFax = m_pFaxLB->GetSelectEntry();
f085be
         aAddPrinterAttr.sFaxName = sNone == sFax ? aEmptyOUStr : sFax;
f085be
@@ -431,6 +435,7 @@ void    SwAddPrinterTabPage::Reset( const SfxItemSet&  )
f085be
         m_pOnlyRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ONLY ) ;
f085be
         m_pEndRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDDOC ) ;
f085be
         m_pEndPageRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDPAGE ) ;
f085be
+        m_pInMarginsRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_INMARGINS ) ;
f085be
         m_pFaxLB->SelectEntry( pAddPrinterAttr->sFaxName );
f085be
     }
f085be
     if (m_pProspectCB->IsChecked())
f085be
@@ -440,6 +445,7 @@ void    SwAddPrinterTabPage::Reset( const SfxItemSet&  )
f085be
         m_pOnlyRB->Enable( sal_False );
f085be
         m_pEndRB->Enable( sal_False );
f085be
         m_pEndPageRB->Enable( sal_False );
f085be
+        m_pInMarginsRB->Enable( sal_False );
f085be
     }
f085be
     else
f085be
         m_pProspectCB_RTL->Enable( sal_False );
f085be
@@ -461,6 +467,7 @@ IMPL_LINK_NOARG_INLINE_START(SwAddPrinterTabPage, AutoClickHdl)
f085be
     m_pOnlyRB->Enable( !bIsProspect );
f085be
     m_pEndRB->Enable( !bIsProspect );
f085be
     m_pEndPageRB->Enable( !bIsProspect );
f085be
+    m_pInMarginsRB->Enable( !bIsProspect );
f085be
     return 0;
f085be
 }
f085be
 IMPL_LINK_NOARG_INLINE_END(SwAddPrinterTabPage, AutoClickHdl)
f085be
diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
f085be
index 8ca06e7..e6b7cb6 100644
f085be
--- a/sw/source/ui/docvw/PostItMgr.cxx
f085be
+++ b/sw/source/ui/docvw/PostItMgr.cxx
f085be
@@ -807,6 +807,22 @@ bool SwPostItMgr::BorderOverPageBorder(unsigned long aPage) const
f085be
         return false;
f085be
 }
f085be
 
f085be
+void SwPostItMgr::DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage)
f085be
+{
f085be
+    assert(nPage < mPages.size());
f085be
+    if (nPage >= mPages.size())
f085be
+        return;
f085be
+    for(SwSidebarItem_iterator i = mPages[nPage]->mList->begin(); i != mPages[nPage]->mList->end(); ++i)
f085be
+    {
f085be
+        SwSidebarWin* pPostIt = (*i)->pPostIt;
f085be
+        if (!pPostIt)
f085be
+            continue;
f085be
+        Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
f085be
+        Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel()));
f085be
+        pPostIt->Draw(pOutDev, aPoint, aSize, 0);
f085be
+    }
f085be
+}
f085be
+
f085be
 void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
f085be
 {
f085be
     OSL_ENSURE((lScroll % GetScrollSize() )==0,"SwPostItMgr::Scroll: scrolling by wrong value");
f085be
diff --git a/sw/source/ui/docvw/SidebarTxtControl.cxx b/sw/source/ui/docvw/SidebarTxtControl.cxx
f085be
index b1d3767..15af740 100644
f085be
--- a/sw/source/ui/docvw/SidebarTxtControl.cxx
f085be
+++ b/sw/source/ui/docvw/SidebarTxtControl.cxx
f085be
@@ -118,6 +118,46 @@ void SidebarTxtControl::RequestHelp(const HelpEvent &rEvt)
f085be
     }
f085be
 }
f085be
 
f085be
+void SidebarTxtControl::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, sal_uLong)
f085be
+{
f085be
+    if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
f085be
+    {
f085be
+        if ( mrSidebarWin.IsMouseOverSidebarWin() ||
f085be
+             HasFocus() )
f085be
+        {
f085be
+            pDev->DrawGradient( Rectangle( Point(0,0) + rPt, PixelToLogic(GetSizePixel()) ),
f085be
+                          Gradient( GradientStyle_LINEAR,
f085be
+                                    mrSidebarWin.ColorDark(),
f085be
+                                    mrSidebarWin.ColorDark() ) );
f085be
+        }
f085be
+        else
f085be
+        {
f085be
+            pDev->DrawGradient( Rectangle( Point(0,0) + rPt, PixelToLogic(GetSizePixel()) ),
f085be
+                          Gradient( GradientStyle_LINEAR,
f085be
+                                    mrSidebarWin.ColorLight(),
f085be
+                                    mrSidebarWin.ColorDark()));
f085be
+        }
f085be
+    }
f085be
+
f085be
+    if ( GetTextView() )
f085be
+    {
f085be
+        GetTextView()->GetOutliner()->Draw(pDev, Rectangle(rPt, rSz));
f085be
+    }
f085be
+
f085be
+    if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED )
f085be
+    {
f085be
+        SetLineColor(mrSidebarWin.GetChangeColor());
f085be
+        pDev->DrawLine( PixelToLogic( GetPosPixel(), pDev->GetMapMode() ),
f085be
+                  PixelToLogic( GetPosPixel() +
f085be
+                                Point( GetSizePixel().Width(),
f085be
+                                       GetSizePixel().Height() ), pDev->GetMapMode() ) );
f085be
+        pDev->DrawLine( PixelToLogic( GetPosPixel() +
f085be
+                                Point( GetSizePixel().Width(),0), pDev->GetMapMode() ),
f085be
+                  PixelToLogic( GetPosPixel() +
f085be
+                                Point( 0, GetSizePixel().Height() ), pDev->GetMapMode() ) );
f085be
+    }
f085be
+}
f085be
+
f085be
 void SidebarTxtControl::Paint( const Rectangle& rRect)
f085be
 {
f085be
     if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
f085be
diff --git a/sw/source/ui/docvw/SidebarTxtControl.hxx b/sw/source/ui/docvw/SidebarTxtControl.hxx
f085be
index 37829b2..66e282f 100644
f085be
--- a/sw/source/ui/docvw/SidebarTxtControl.hxx
f085be
+++ b/sw/source/ui/docvw/SidebarTxtControl.hxx
f085be
@@ -66,6 +66,8 @@ class SidebarTxtControl : public Control
f085be
         DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
f085be
 
f085be
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
f085be
+        virtual void    Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong);
f085be
+
f085be
 };
f085be
 
f085be
 } } // end of namespace sw::sidebarwindows
f085be
diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx
f085be
index 4cf128a..275b72e 100644
f085be
--- a/sw/source/ui/docvw/SidebarWin.cxx
f085be
+++ b/sw/source/ui/docvw/SidebarWin.cxx
f085be
@@ -64,10 +64,12 @@
f085be
 #include <langhelper.hxx>
f085be
 
f085be
 #include <sw_primitivetypes2d.hxx>
f085be
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
f085be
 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
f085be
 #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
f085be
 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
f085be
 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
f085be
+#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
f085be
 #include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
f085be
 
f085be
 namespace sw { namespace sidebarwindows {
f085be
@@ -212,6 +214,59 @@ void SwSidebarWin::Paint( const Rectangle& rRect)
f085be
     }
f085be
 }
f085be
 
f085be
+void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, sal_uLong nInFlags)
f085be
+{
f085be
+    if (mpMetadataAuthor->IsVisible() )
f085be
+    {
f085be
+        //draw left over space
f085be
+        if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
f085be
+        {
f085be
+            pDev->SetFillColor(COL_BLACK);
f085be
+        }
f085be
+        else
f085be
+        {
f085be
+            pDev->SetFillColor(mColorDark);
f085be
+        }
f085be
+        pDev->SetLineColor();
f085be
+        pDev->DrawRect( Rectangle( rPt, rSz ) );
f085be
+    }
f085be
+
f085be
+    if (mpMetadataAuthor->IsVisible())
f085be
+    {
f085be
+        Font aOrigFont(mpMetadataAuthor->GetControlFont());
f085be
+        Size aSize(PixelToLogic(mpMetadataAuthor->GetSizePixel()));
f085be
+        Point aPos(PixelToLogic(mpMetadataAuthor->GetPosPixel()));
f085be
+        aPos += rPt;
f085be
+        Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() );
f085be
+        mpMetadataAuthor->SetControlFont( aFont );
f085be
+        mpMetadataAuthor->Draw(pDev, aPos, aSize, nInFlags);
f085be
+        mpMetadataAuthor->SetControlFont( aOrigFont );
f085be
+    }
f085be
+
f085be
+    if (mpMetadataDate->IsVisible())
f085be
+    {
f085be
+        Font aOrigFont(mpMetadataDate->GetControlFont());
f085be
+        Size aSize(PixelToLogic(mpMetadataDate->GetSizePixel()));
f085be
+        Point aPos(PixelToLogic(mpMetadataDate->GetPosPixel()));
f085be
+        aPos += rPt;
f085be
+        Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
f085be
+        mpMetadataDate->SetControlFont( aFont );
f085be
+        mpMetadataDate->Draw(pDev, aPos, aSize, nInFlags);
f085be
+        mpMetadataDate->SetControlFont( aOrigFont );
f085be
+    }
f085be
+
f085be
+    mpSidebarTxtControl->Draw(pDev, rPt, rSz, nInFlags);
f085be
+
f085be
+    const drawinglayer::primitive2d::Primitive2DSequence& rSequence = mpAnchor->getOverlayObjectPrimitive2DSequence();
f085be
+    const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
f085be
+    drawinglayer::processor2d::BaseProcessor2D * pProcessor =
f085be
+        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(
f085be
+            *pDev, aNewViewInfos );
f085be
+
f085be
+    pProcessor->process(rSequence);
f085be
+    delete pProcessor;
f085be
+}
f085be
+
f085be
 void SwSidebarWin::SetPosSizePixelRect( long nX,
f085be
                                         long nY,
f085be
                                         long nWidth,
f085be
diff --git a/sw/source/ui/inc/optpage.hxx b/sw/source/ui/inc/optpage.hxx
f085be
index 3e196e2..fa8f6b7 100644
f085be
--- a/sw/source/ui/inc/optpage.hxx
f085be
+++ b/sw/source/ui/inc/optpage.hxx
f085be
@@ -104,6 +104,7 @@ class SwAddPrinterTabPage : public SfxTabPage
f085be
     RadioButton*    m_pOnlyRB;
f085be
     RadioButton*    m_pEndRB;
f085be
     RadioButton*    m_pEndPageRB;
f085be
+    RadioButton*    m_pInMarginsRB;
f085be
 
f085be
     CheckBox*       m_pPrintEmptyPagesCB;
f085be
     CheckBox*       m_pPaperFromSetupCB;
f085be
diff --git a/sw/uiconfig/swriter/ui/printoptionspage.ui b/sw/uiconfig/swriter/ui/printoptionspage.ui
f085be
index 0bf9afe..95e5ae2 100644
f085be
--- a/sw/uiconfig/swriter/ui/printoptionspage.ui
f085be
+++ b/sw/uiconfig/swriter/ui/printoptionspage.ui
f085be
@@ -1,6 +1,7 @@
f085be
 
f085be
+
f085be
 <interface>
f085be
-  
f085be
+  <requires lib="gtk+" version="3.0"/>
f085be
   <object class="GtkBox" id="PrintOptionsPage">
f085be
     <property name="visible">True</property>
f085be
     <property name="can_focus">False</property>
f085be
@@ -344,7 +345,7 @@
f085be
                         <property name="use_underline">True</property>
f085be
                         <property name="xalign">0</property>
f085be
                         <property name="draw_indicator">True</property>
f085be
-                        <property name="group">none</property>
f085be
+                        <property name="group">inmargins</property>
f085be
                       </object>
f085be
                       <packing>
f085be
                         <property name="left_attach">0</property>
f085be
@@ -353,6 +354,24 @@
f085be
                         <property name="height">1</property>
f085be
                       </packing>
f085be
                     </child>
f085be
+                    <child>
f085be
+                      <object class="GtkRadioButton" id="inmargins">
f085be
+                        <property name="label" translatable="yes">In margins</property>
f085be
+                        <property name="visible">True</property>
f085be
+                        <property name="can_focus">True</property>
f085be
+                        <property name="receives_default">False</property>
f085be
+                        <property name="use_underline">True</property>
f085be
+                        <property name="xalign">0</property>
f085be
+                        <property name="draw_indicator">True</property>
f085be
+                        <property name="group">none</property>
f085be
+                      </object>
f085be
+                      <packing>
f085be
+                        <property name="left_attach">0</property>
f085be
+                        <property name="top_attach">4</property>
f085be
+                        <property name="width">1</property>
f085be
+                        <property name="height">1</property>
f085be
+                      </packing>
f085be
+                    </child>
f085be
                   </object>
f085be
                 </child>
f085be
               </object>
f085be
-- 
f085be
1.8.5.3
f085be