diff options
author | pv2k <vidhey96@gmail.com> | 2017-05-11 23:49:54 +0530 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-07-09 23:19:14 +0200 |
commit | fba28df77d7e98663d1cf77ac206f8799fce4108 (patch) | |
tree | 7ff28253e31d314b4947aed8858bcd5a09a1c14d /sd/source/ui/view/drviews7.cxx | |
parent | 4eae2eeb4c3942648aa5d32678ddb5bbbae9d221 (diff) |
Added margin feature to the Draw's SideBar
Change-Id: I53b5430d1563fcceae29418fd5907ac42ea856e7
Reviewed-on: https://gerrit.libreoffice.org/37626
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sd/source/ui/view/drviews7.cxx')
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 6e9d40f365e7..d829639e0bae 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -18,6 +18,7 @@ */ #include <memory> + #include <sal/config.h> #include <utility> @@ -27,11 +28,14 @@ #include <com/sun/star/linguistic2/XThesaurus.hpp> #include <svx/fmglob.hxx> #include <svx/globl3d.hxx> +#include <svx/rulritem.hxx> #include <svx/svdouno.hxx> #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> #include <editeng/outlobj.hxx> #include <editeng/sizeitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/lrspitem.hxx> #include <officecfg/Office/Common.hxx> #include <officecfg/Office/Impress.hxx> #include <svx/svxids.hrc> @@ -40,6 +44,7 @@ #include <svx/fmshell.hxx> #include <svl/eitem.hxx> #include <svl/aeitem.hxx> +#include <svl/itemset.hxx> #include <svl/stritem.hxx> #include <svl/visitem.hxx> #include <svl/whiter.hxx> @@ -73,6 +78,7 @@ #include "Outliner.hxx" #include "drawdoc.hxx" +#include "DrawViewShell.hxx" #include "sdresid.hxx" #include "sdpage.hxx" #include "Client.hxx" @@ -80,6 +86,7 @@ #include "zoomlist.hxx" #include "slideshow.hxx" #include "drawview.hxx" +#include "View.hxx" #include "ViewShellBase.hxx" #include "ViewShellManager.hxx" #include "LayerTabBar.hxx" @@ -149,6 +156,7 @@ using namespace ::com::sun::star::linguistic2; break; } + case SotClipboardFormatId::LINK_SOURCE: case SotClipboardFormatId::DRAWING: case SotClipboardFormatId::SVXB: @@ -249,6 +257,44 @@ void DrawViewShell::GetDrawAttrState(SfxItemSet& rSet) return pOL; } +void DrawViewShell::GetMarginProperties( SfxItemSet &rSet ) +{ + SdPage *pPage = getCurrentPage(); + SfxWhichIter aIter( rSet ); + sal_uInt16 nWhich = aIter.FirstWhich(); + while ( nWhich ) + { + switch ( nWhich ) + { + case SID_ATTR_PAGE_LRSPACE: + { + // const SvxLRSpaceItem aTmpPageLRSpace ( rDesc.GetMaster().GetLRSpace() ); + const SvxLongLRSpaceItem aLongLR( + (long)pPage->GetLftBorder(), + (long)pPage->GetRgtBorder(), + SID_ATTR_PAGE_LRSPACE ); + rSet.Put( aLongLR ); + } + break; + + case SID_ATTR_PAGE_ULSPACE: + { + // const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); + SvxLongULSpaceItem aLongUL( + (long)pPage->GetUppBorder(), + (long)pPage->GetLwrBorder(), + SID_ATTR_PAGE_ULSPACE ); + rSet.Put( aLongUL ); + } + break; + + default: + break; + } + nWhich = aIter.NextWhich(); + } +} + void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { if (mpDrawView == nullptr) @@ -1712,6 +1758,18 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq) SdPage *pPage = getCurrentPage(); sal_uInt16 nSlotId = rReq.GetSlot(); const SfxItemSet *pArgs = rReq.GetArgs(); + // const size_t nDescId = rSh->GetCurPageDesc(); + // const SdPage& rDesc = rSh->GetPageDesc( nDescId ); + Size maSize = pPage->GetSize(); + PageKind ePageKind = GetPageKind(); + const SfxPoolItem* pPoolItem = nullptr; + Size aNewSize(maSize); + sal_Int32 nLeft = -1, nRight = -1, nUpper = -1, nLower = -1; + bool bScaleAll = true; + Orientation eOrientation = pPage->GetOrientation(); + SdPage* pMasterPage = pPage->IsMasterPage() ? pPage : &static_cast<SdPage&>(pPage->TRG_GetMasterPage()); + bool bFullSize = pMasterPage->IsBackgroundFullSize(); + sal_uInt16 nPaperBin = pPage->GetPaperBin(); if ( pPage && pArgs ) { @@ -1784,6 +1842,44 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq) rReq.Done(); } + else + { + switch (nSlotId) + { + case SID_ATTR_PAGE_LRSPACE: + if( pArgs->GetItemState(GetPool().GetWhich(SID_ATTR_PAGE_LRSPACE), + true,&pPoolItem) == SfxItemState::SET ) + { + nLeft = static_cast<const SvxLongLRSpaceItem*>(pPoolItem)->GetLeft(); + nRight = static_cast<const SvxLongLRSpaceItem*>(pPoolItem)->GetRight(); + if (nLeft != -1 && nUpper == -1) + { + nUpper = pPage->GetUppBorder(); + nLower = pPage->GetLwrBorder(); + } + SetPageSizeAndBorder(ePageKind, aNewSize, nLeft, nRight, nUpper, nLower, bScaleAll, eOrientation, nPaperBin, bFullSize ); + } + break; + + case SID_ATTR_PAGE_ULSPACE: + if( pArgs->GetItemState(SID_ATTR_PAGE_ULSPACE, + true,&pPoolItem) == SfxItemState::SET ) + { + nUpper = static_cast<const SvxLongULSpaceItem*>(pPoolItem)->GetUpper(); + nLower = static_cast<const SvxLongULSpaceItem*>(pPoolItem)->GetLower(); + if (nLeft == -1 && nUpper != -1) + { + nLeft = pPage->GetLftBorder(); + nRight = pPage->GetRgtBorder(); + } + SetPageSizeAndBorder(ePageKind, aNewSize, nLeft, nRight, nUpper, nLower, bScaleAll, eOrientation, nPaperBin, bFullSize ); + } + break; + + default: + break; + } + } } } |