diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/uibase/docvw/PostItMgr.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/uibase/docvw/SidebarTxtControl.cxx | 40 | ||||
-rw-r--r-- | sw/source/core/uibase/docvw/SidebarTxtControl.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/uibase/docvw/SidebarWin.cxx | 55 | ||||
-rw-r--r-- | sw/source/core/uibase/inc/optpage.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/view/printdata.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/view/vprint.cxx | 49 | ||||
-rw-r--r-- | sw/source/ui/config/optdlg.src | 1 | ||||
-rw-r--r-- | sw/source/ui/config/optpage.cxx | 6 |
10 files changed, 173 insertions, 6 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index eb3133a39f98..a5cbf3bf3665 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -6172,7 +6172,7 @@ static void lcl_paintBitmapExToRect(OutputDevice *pOut, const Point& aPoint, con SwAlignRect( aPageRect, _pViewShell ); const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr(); - if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes()) // do not show anything in print preview + if (pMgr /*&& pMgr->ShowNotes()*/ && pMgr->HasNotes()) // do not show anything in print preview { sal_Int32 nScrollerHeight = pMgr->GetSidebarScrollerHeight(); const Rectangle &aVisRect = _pViewShell->VisArea().SVRect(); diff --git a/sw/source/core/uibase/docvw/PostItMgr.cxx b/sw/source/core/uibase/docvw/PostItMgr.cxx index 4193ad61c7e3..e63ce8b7b2cf 100644 --- a/sw/source/core/uibase/docvw/PostItMgr.cxx +++ b/sw/source/core/uibase/docvw/PostItMgr.cxx @@ -823,6 +823,22 @@ bool SwPostItMgr::BorderOverPageBorder(unsigned long aPage) const return false; } +void SwPostItMgr::DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage) +{ + assert(nPage < mPages.size()); + if (nPage >= mPages.size()) + return; + for(SwSidebarItem_iterator i = mPages[nPage]->mList->begin(); i != mPages[nPage]->mList->end(); ++i) + { + SwSidebarWin* pPostIt = (*i)->pPostIt; + if (!pPostIt) + continue; + Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel())); + Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel())); + pPostIt->Draw(pOutDev, aPoint, aSize, 0); + } +} + void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage) { OSL_ENSURE((lScroll % GetScrollSize() )==0,"SwPostItMgr::Scroll: scrolling by wrong value"); diff --git a/sw/source/core/uibase/docvw/SidebarTxtControl.cxx b/sw/source/core/uibase/docvw/SidebarTxtControl.cxx index 421bd0a8f3f0..4e84a0be9333 100644 --- a/sw/source/core/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/core/uibase/docvw/SidebarTxtControl.cxx @@ -119,6 +119,46 @@ void SidebarTxtControl::RequestHelp(const HelpEvent &rEvt) } } +void SidebarTxtControl::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, sal_uLong) +{ + if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) + { + if ( mrSidebarWin.IsMouseOverSidebarWin() || + HasFocus() ) + { + pDev->DrawGradient( Rectangle( Point(0,0) + rPt, PixelToLogic(GetSizePixel()) ), + Gradient( GradientStyle_LINEAR, + mrSidebarWin.ColorDark(), + mrSidebarWin.ColorDark() ) ); + } + else + { + pDev->DrawGradient( Rectangle( Point(0,0) + rPt, PixelToLogic(GetSizePixel()) ), + Gradient( GradientStyle_LINEAR, + mrSidebarWin.ColorLight(), + mrSidebarWin.ColorDark())); + } + } + + if ( GetTextView() ) + { + GetTextView()->GetOutliner()->Draw(pDev, Rectangle(rPt, rSz)); + } + + if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED ) + { + SetLineColor(mrSidebarWin.GetChangeColor()); + pDev->DrawLine( PixelToLogic( GetPosPixel(), pDev->GetMapMode() ), + PixelToLogic( GetPosPixel() + + Point( GetSizePixel().Width(), + GetSizePixel().Height() ), pDev->GetMapMode() ) ); + pDev->DrawLine( PixelToLogic( GetPosPixel() + + Point( GetSizePixel().Width(),0), pDev->GetMapMode() ), + PixelToLogic( GetPosPixel() + + Point( 0, GetSizePixel().Height() ), pDev->GetMapMode() ) ); + } +} + void SidebarTxtControl::Paint( const Rectangle& rRect) { if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) diff --git a/sw/source/core/uibase/docvw/SidebarTxtControl.hxx b/sw/source/core/uibase/docvw/SidebarTxtControl.hxx index ae524a094f71..edb9efd8b9d2 100644 --- a/sw/source/core/uibase/docvw/SidebarTxtControl.hxx +++ b/sw/source/core/uibase/docvw/SidebarTxtControl.hxx @@ -66,6 +66,8 @@ class SidebarTxtControl : public Control DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*); virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; + + virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) SAL_OVERRIDE; }; } } // end of namespace sw::sidebarwindows diff --git a/sw/source/core/uibase/docvw/SidebarWin.cxx b/sw/source/core/uibase/docvw/SidebarWin.cxx index 930b95b9a460..ef6d4d35faf1 100644 --- a/sw/source/core/uibase/docvw/SidebarWin.cxx +++ b/sw/source/core/uibase/docvw/SidebarWin.cxx @@ -72,10 +72,12 @@ #include <ndtxt.hxx> #include <sw_primitivetypes2d.hxx> +#include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <drawinglayer/primitive2d/primitivetools2d.hxx> #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> #include <drawinglayer/primitive2d/shadowprimitive2d.hxx> namespace sw { namespace sidebarwindows { @@ -224,6 +226,59 @@ void SwSidebarWin::Paint( const Rectangle& rRect) } } +void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, sal_uLong nInFlags) +{ + if (mpMetadataAuthor->IsVisible() ) + { + //draw left over space + if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) + { + pDev->SetFillColor(COL_BLACK); + } + else + { + pDev->SetFillColor(mColorDark); + } + pDev->SetLineColor(); + pDev->DrawRect( Rectangle( rPt, rSz ) ); + } + + if (mpMetadataAuthor->IsVisible()) + { + Font aOrigFont(mpMetadataAuthor->GetControlFont()); + Size aSize(PixelToLogic(mpMetadataAuthor->GetSizePixel())); + Point aPos(PixelToLogic(mpMetadataAuthor->GetPosPixel())); + aPos += rPt; + Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() ); + mpMetadataAuthor->SetControlFont( aFont ); + mpMetadataAuthor->Draw(pDev, aPos, aSize, nInFlags); + mpMetadataAuthor->SetControlFont( aOrigFont ); + } + + if (mpMetadataDate->IsVisible()) + { + Font aOrigFont(mpMetadataDate->GetControlFont()); + Size aSize(PixelToLogic(mpMetadataDate->GetSizePixel())); + Point aPos(PixelToLogic(mpMetadataDate->GetPosPixel())); + aPos += rPt; + Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() ); + mpMetadataDate->SetControlFont( aFont ); + mpMetadataDate->Draw(pDev, aPos, aSize, nInFlags); + mpMetadataDate->SetControlFont( aOrigFont ); + } + + mpSidebarTxtControl->Draw(pDev, rPt, rSz, nInFlags); + + const drawinglayer::primitive2d::Primitive2DSequence& rSequence = mpAnchor->getOverlayObjectPrimitive2DSequence(); + const drawinglayer::geometry::ViewInformation2D aNewViewInfos; + drawinglayer::processor2d::BaseProcessor2D * pProcessor = + drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice( + *pDev, aNewViewInfos ); + + pProcessor->process(rSequence); + delete pProcessor; +} + void SwSidebarWin::SetPosSizePixelRect( long nX, long nY, long nWidth, diff --git a/sw/source/core/uibase/inc/optpage.hxx b/sw/source/core/uibase/inc/optpage.hxx index 2cbbe728b26e..5e20bf405f91 100644 --- a/sw/source/core/uibase/inc/optpage.hxx +++ b/sw/source/core/uibase/inc/optpage.hxx @@ -104,6 +104,7 @@ class SwAddPrinterTabPage : public SfxTabPage RadioButton* m_pOnlyRB; RadioButton* m_pEndRB; RadioButton* m_pEndPageRB; + RadioButton* m_pInMarginsRB; CheckBox* m_pPrintEmptyPagesCB; CheckBox* m_pPaperFromSetupCB; diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index 473940d99267..9bf1a45964fd 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -170,8 +170,8 @@ SwPrintUIOptions::SwPrintUIOptions( { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); - OSL_ENSURE( aLocalizedStrings.Count() >= 30, "resource incomplete" ); - if( aLocalizedStrings.Count() < 30 ) // bad resource ? + OSL_ENSURE( aLocalizedStrings.Count() >= 31, "resource incomplete" ); + if( aLocalizedStrings.Count() < 31 ) // bad resource ? return; // printing HTML sources does not have any valid UI options. @@ -320,11 +320,12 @@ SwPrintUIOptions::SwPrintUIOptions( OUString(), aContentsOpt); // create a list box for notes content const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts(); - aChoices.realloc( 4 ); + aChoices.realloc( 5 ); aChoices[0] = aLocalizedStrings.GetString( 13 ); aChoices[1] = aLocalizedStrings.GetString( 14 ); aChoices[2] = aLocalizedStrings.GetString( 15 ); aChoices[3] = aLocalizedStrings.GetString( 16 ); + aChoices[4] = aLocalizedStrings.GetString( 30 ); aHelpIds.realloc( 2 ); aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:FixedText"; aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:ListBox"; diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 74841b529cad..b680e522f429 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -69,6 +69,7 @@ #include <viscrs.hxx> #include <fmtpdsc.hxx> #include <globals.hrc> +#include "PostItMgr.hxx" using namespace ::com::sun::star; @@ -454,13 +455,33 @@ sal_Bool SwViewShell::PrintOrPDFExport( // output device is now provided by a call from outside the Writer) pOutDev->Push(); + // fdo#36815 for comments in margins print to a metafile + // and then scale that metafile down so that the comments + // will fit on the real page, and replay that scaled + // output to the real outputdevice + GDIMetaFile *pOrigRecorder(NULL); + GDIMetaFile *pMetaFile(NULL); + sal_Int16 nPostItMode = rPrintData.GetPrintPostIts(); + if (nPostItMode == POSTITS_INMARGINS) + { + //get and disable the existing recorder + pOrigRecorder = pOutDev->GetConnectMetaFile(); + pOutDev->SetConnectMetaFile(NULL); + // turn off output to the device + pOutDev->EnableOutput(false); + // just record the rendering commands to the metafile + // instead + pMetaFile = new GDIMetaFile; + pMetaFile->Record(pOutDev); + } + // Print/PDF export for (multi-)selection has already generated a // temporary document with the selected text. // (see XRenderable implementation in unotxdoc.cxx) // It is implemented this way because PDF export calls this Prt function // once per page and we do not like to always have the temporary document // to be created that often here. - SwViewShell *pShell = new SwViewShell( *this, 0, pOutDev ); + SwViewShell *pShell = new SwViewShell(*this, 0, pOutDev); SdrView *pDrawView = pShell->GetDrawView(); if (pDrawView) @@ -502,13 +523,37 @@ sal_Bool SwViewShell::PrintOrPDFExport( ::SetSwVisArea( pViewSh2, pStPage->Frm() ); - pShell->InitPrt( pOutDev ); + pShell->InitPrt(pOutDev); ::SetSwVisArea( pViewSh2, pStPage->Frm() ); pStPage->GetUpper()->Paint( pStPage->Frm(), &rPrintData ); SwPaintQueue::Repaint(); + + if (nPostItMode == POSTITS_INMARGINS) + { + SwPostItMgr *pPostItManager = pShell->GetPostItMgr(); + pPostItManager->CalcRects(); + pPostItManager->LayoutPostIts(); + pPostItManager->DrawNotesForPage(pOutDev, nPage-1); + + //Now scale the recorded page down so the notes + //will fit in the final page + pMetaFile->Stop(); + pMetaFile->WindStart(); + double fScale = 0.75; + pMetaFile->Scale( fScale, fScale ); + pMetaFile->WindStart(); + + //Enable output the the device again + pOutDev->EnableOutput(true); + //Restore the original recorder + pOutDev->SetConnectMetaFile(pOrigRecorder); + //play back the scaled page + pMetaFile->Play(pOutDev); + delete pMetaFile; + } } delete pShell; diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 748560a2fab8..b5ae69cf1691 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -71,6 +71,7 @@ StringArray STR_PRINTOPTUI < "~All pages"; >; < "Pa~ges"; >; < "~Selection"; >; + < "Place in margins"; >; }; }; diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index e57265df7164..602896bf04f3 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -312,6 +312,7 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(Window* pParent, get(m_pOnlyRB, "only"); get(m_pEndRB, "end"); get(m_pEndPageRB, "endpage"); + get(m_pInMarginsRB, "inmargins"); get(m_pPrintEmptyPagesCB, "blankpages"); get(m_pPaperFromSetupCB, "papertray"); get(m_pFaxLB, "fax"); @@ -332,6 +333,7 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(Window* pParent, m_pPaperFromSetupCB->SetClickHdl( aLk ); m_pPrintEmptyPagesCB->SetClickHdl( aLk ); m_pEndPageRB->SetClickHdl( aLk ); + m_pInMarginsRB->SetClickHdl( aLk ); m_pEndRB->SetClickHdl( aLk ); m_pOnlyRB->SetClickHdl( aLk ); m_pNoRB->SetClickHdl( aLk ); @@ -398,6 +400,8 @@ bool SwAddPrinterTabPage::FillItemSet( SfxItemSet& rCoreSet ) POSTITS_ENDDOC; if (m_pEndPageRB->IsChecked()) aAddPrinterAttr.nPrintPostIts = POSTITS_ENDPAGE; + if (m_pInMarginsRB->IsChecked()) aAddPrinterAttr.nPrintPostIts = + POSTITS_INMARGINS; OUString sFax = m_pFaxLB->GetSelectEntry(); aAddPrinterAttr.sFaxName = sNone == sFax ? aEmptyOUStr : sFax; @@ -431,6 +435,7 @@ void SwAddPrinterTabPage::Reset( const SfxItemSet& ) m_pOnlyRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ONLY ) ; m_pEndRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDDOC ) ; m_pEndPageRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDPAGE ) ; + m_pInMarginsRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_INMARGINS ) ; m_pFaxLB->SelectEntry( pAddPrinterAttr->sFaxName ); } if (m_pProspectCB->IsChecked()) @@ -461,6 +466,7 @@ IMPL_LINK_NOARG_INLINE_START(SwAddPrinterTabPage, AutoClickHdl) m_pOnlyRB->Enable( !bIsProspect ); m_pEndRB->Enable( !bIsProspect ); m_pEndPageRB->Enable( !bIsProspect ); + m_pInMarginsRB->Enable( !bIsProspect ); return 0; } IMPL_LINK_NOARG_INLINE_END(SwAddPrinterTabPage, AutoClickHdl) |