diff -cNr old/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu new/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
*** old/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu Tue Aug 21 00:48:44 2007
--- new/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu Fri Dec 21 20:14:12 2007
***************
*** 213,218 ****
--- 213,223 ----
1
+
+
+ Margins
+
+
Close Preview
diff -cNr old/officecfg/registry/data/org/openoffice/Office/UI/localize.sdf new/officecfg/registry/data/org/openoffice/Office/UI/localize.sdf
*** old/officecfg/registry/data/org/openoffice/Office/UI/localize.sdf Fri Dec 21 20:15:00 2007
--- new/officecfg/registry/data/org/openoffice/Office/UI/localize.sdf Mon Nov 12 16:23:22 2007
***************
*** 3756,3762 ****
officecfg registry\data\org\openoffice\Office\UI\CalcCommands.xcu 0 value ..CalcCommands.UserInterface.Commands..uno:ClosePreview Label 0 zh-CN 关闭页面预览 2002-02-02 02:02:02
officecfg registry\data\org\openoffice\Office\UI\CalcCommands.xcu 0 value ..CalcCommands.UserInterface.Commands..uno:ClosePreview Label 0 zh-TW 關閉預覽 2002-02-02 02:02:02
officecfg registry\data\org\openoffice\Office\UI\CalcCommands.xcu 0 value ..CalcCommands.UserInterface.Commands..uno:ClosePreview Label 0 zu Vala Umbukiso wangaphambili 2002-02-02 02:02:02
- officecfg registry\data\org\openoffice\Office\UI\CalcCommands.xcu 0 value ..CalcCommands.UserInterface.Commands..uno:Margins Label 0 en-GB Margins 2002-02-02 02:02:02
officecfg registry\data\org\openoffice\Office\UI\CalcCommands.xcu 0 value ..CalcCommands.UserInterface.Commands..uno:ColumnWidth ContextLabel 0 af ~Wydte... 2002-02-02 02:02:02
officecfg registry\data\org\openoffice\Office\UI\CalcCommands.xcu 0 value ..CalcCommands.UserInterface.Commands..uno:ColumnWidth ContextLabel 0 be-BY Шырыня... 2002-02-02 02:02:02
officecfg registry\data\org\openoffice\Office\UI\CalcCommands.xcu 0 value ..CalcCommands.UserInterface.Commands..uno:ColumnWidth ContextLabel 0 bg ~Ширина... 2002-02-02 02:02:02
--- 3756,3761 ----
diff -cNr old/sc/inc/sc.hrc new/sc/inc/sc.hrc
*** old/sc/inc/sc.hrc Thu Nov 22 03:08:20 2007
--- new/sc/inc/sc.hrc Fri Dec 21 19:13:12 2007
***************
*** 908,913 ****
--- 908,914 ----
#define SID_PREVIEW_ZOOMOUT (SID_PREVIEW_START+6)
#define SID_PREVIEW_CLOSE (SID_PREVIEW_START+7)
#define SID_PREVIEW_END (SID_PREVIEW_START+20)
+ #define SID_PREVIEW_MARGIN (SID_PREVIEW_START+8)
//aus sfx: #define SID_KEYFUNC_START (SID_PREVIEW_END+5)
#define SID_CURSORDOWN_SEL (SID_KEYFUNC_START + 0)
diff -cNr old/sc/sdi/prevwsh.sdi new/sc/sdi/prevwsh.sdi
*** old/sc/sdi/prevwsh.sdi Fri Sep 9 02:13:58 2005
--- new/sc/sdi/prevwsh.sdi Fri Dec 21 19:14:14 2007
***************
*** 46,51 ****
--- 46,52 ----
SID_PREVIEW_PREVIOUS [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_PREVIEW_FIRST [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_PREVIEW_LAST [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
+ SID_PREVIEW_MARGIN [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SfxVoidItem GoUpBlock SID_CURSORPAGEUP
(
diff -cNr old/sc/sdi/scalc.sdi new/sc/sdi/scalc.sdi
*** old/sc/sdi/scalc.sdi Tue Aug 21 00:50:30 2007
--- new/sc/sdi/scalc.sdi Fri Dec 21 19:15:00 2007
***************
*** 7580,7585 ****
--- 7580,7610 ----
]
//--------------------------------------------------------------------------
+ SfxVoidItem Margins SID_PREVIEW_MARGIN
+ ()
+ [
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+ ]
+
+ //--------------------------------------------------------------------------
SfxVoidItem SelectTables SID_SELECT_TABLES
(SfxIntegerListItem Tables SID_SELECT_TABLES)
[
diff -cNr old/sc/source/ui/inc/preview.hxx new/sc/source/ui/inc/preview.hxx
*** old/sc/source/ui/inc/preview.hxx Wed Jan 9 15:40:38 2008
--- new/sc/source/ui/inc/preview.hxx Thu Jan 24 17:00:22 2008
***************
*** 79,84 ****
--- 79,115 ----
ScDocShell* pDocShell;
ScPreviewShell* pViewShell;
+ BOOL bLeftRulerMove;
+ BOOL bRightRulerMove;
+ BOOL bTopRulerMove;
+ BOOL bBottomRulerMove;
+ BOOL bHeaderRulerMove;
+ BOOL bFooterRulerMove;
+
+ BOOL bLeftRulerChange;
+ BOOL bRightRulerChange;
+ BOOL bTopRulerChange;
+ BOOL bBottomRulerChange;
+ BOOL bHeaderRulerChange;
+ BOOL bFooterRulerChange;
+ BOOL bPageMargin;
+ Point aLeftRulerChangePt;
+ Point aRightRulerChangePt;
+ Point aTopRulerChangePt;
+ Point aBottomRulerChangePt;
+ Point aHeaderRulerChangePt;
+ Point aFooterRulerChangePt;
+
+ Point aButtonDownChangePoint;
+ BOOL bColRulerMove;
+ ScRange aPageArea;
+ long nRight[ MAXCOL+1 ];
+ ULONG nColNumberButttonDown;
+ USHORT nLeftMarginForFirstCol;
+ Point aButtonDownPt;
+ Point aButtonUpPt;
+ long nHeaderHeight;
+ long nFooterHeight;
void TestLastPage();
void CalcPages( SCTAB nToWhichTab );
***************
*** 91,102 ****
using Window::SetZoom;
protected:
! virtual void Paint( const Rectangle& rRect );
! virtual void Command( const CommandEvent& rCEvt );
! virtual void KeyInput( const KeyEvent& rKEvt );
! virtual void GetFocus();
! virtual void LoseFocus();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
--- 122,136 ----
using Window::SetZoom;
protected:
! virtual void Paint( const Rectangle& rRect );
! virtual void Command( const CommandEvent& rCEvt );
! virtual void KeyInput( const KeyEvent& rKEvt );
! virtual void MouseMove( const MouseEvent& rMEvt );
! virtual void MouseButtonDown( const MouseEvent& rMEvt );
! virtual void MouseButtonUp( const MouseEvent& rMEvt );
! virtual void GetFocus();
! virtual void LoseFocus();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
***************
*** 114,119 ****
--- 148,159 ----
void SetZoom(USHORT nNewZoom);
void SetPageNo( long nPage );
+ BOOL GetPageMargins()const { return bPageMargin; }
+ void SetPageMargins( BOOL bVal ) { bPageMargin = bVal; }
+ void DrawInvert( long nDragPos, USHORT nFlags );
+ void DragMove( long nDragMovePos, USHORT nFlags );
+
+
const ScPreviewLocationData& GetLocationData();
String GetPosString();
diff -cNr old/sc/source/ui/inc/printfun.hxx new/sc/source/ui/inc/printfun.hxx
*** old/sc/source/ui/inc/printfun.hxx Wed Jan 9 15:40:48 2008
--- new/sc/source/ui/inc/printfun.hxx Thu Jan 24 17:01:28 2008
***************
*** 265,270 ****
--- 265,278 ----
const ScPrintState& rState,
const ScPrintOptions* pOptions );
+ ScPrintFunc( ScDocShell* pShell, Window* pWindow, SCTAB nTab,
+ long nPage = 0, long nDocP = 0,
+ const ScRange* pArea = NULL,
+ const ScPrintOptions* pOptions = NULL );
+
+ ScPrintFunc( ScDocShell* pShell, Window* pWindow,
+ const ScPrintState& rState,
+ const ScPrintOptions* pOptions );
~ScPrintFunc();
static void DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double nPrintFactor,
***************
*** 284,291 ****
void ApplyPrintSettings(); // aus DoPrint() schon gerufen
long DoPrint( const MultiSelection& rPageRanges,
! long nStartPage, long nDisplayStart, BOOL bDoPrint,
! SfxProgress* pProgress, ScPreviewLocationData* pLocationData );
// Werte abfragen - sofort
--- 292,301 ----
void ApplyPrintSettings(); // aus DoPrint() schon gerufen
long DoPrint( const MultiSelection& rPageRanges,
! /*long nStartPage, long nDisplayStart, BOOL bDoPrint,
! SfxProgress* pProgress, ScPreviewLocationData* pLocationData );*/
! long nStartPage, long nDisplayStart, BOOL bDoPrint = TRUE,
! SfxProgress* pProgress = NULL, ScPreviewLocationData* pLocationData = NULL);
// Werte abfragen - sofort
***************
*** 305,310 ****
--- 315,330 ----
void GetPrintState( ScPrintState& rState );
BOOL GetLastSourceRange( ScRange& rRange ) const;
+ USHORT GetLeftMargin() const{return nLeftMargin;}
+ USHORT GetRightMargin() const{return nRightMargin;}
+ USHORT GetTopMargin() const{return nTopMargin;}
+ USHORT GetBottomMargin() const{return nBottomMargin;}
+ void SetLeftMargin(USHORT nRulerLeftDistance){ nLeftMargin = nRulerLeftDistance; }
+ void SetRightMargin(USHORT nRulerRightDistance){ nRightMargin = nRulerRightDistance; }
+ void SetTopMargin(USHORT nRulerTopDistance){ nTopMargin = nRulerTopDistance; }
+ void SetBottomMargin(USHORT nRulerBottomDistance){ nBottomMargin = nRulerBottomDistance; }
+ ScPrintHFParam GetHeader(){return aHdr;}
+ ScPrintHFParam GetFooter(){return aFtr;}
private:
void Construct( const ScPrintOptions* pOptions );
diff -cNr old/sc/source/ui/view/preview.cxx new/sc/source/ui/view/preview.cxx
*** old/sc/source/ui/view/preview.cxx Wed Jan 9 15:41:04 2008
--- new/sc/source/ui/view/preview.cxx Thu Jan 24 16:58:54 2008
***************
*** 69,74 ****
--- 69,81 ----
#include "globstr.hrc"
#include "sc.hrc" // fuer ShellInvalidate
#include "AccessibleDocumentPagePreview.hxx"
+ #include "vcl/lineinfo.hxx"
+ #include
+ #include
+ #include
+ #include
+ #include"attrib.hxx"
+ #include"pagepar.hxx"
#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
#include
#endif
***************
*** 117,123 ****
bInPaint( FALSE ),
bInGetState( FALSE ),
pDocShell( pDocSh ),
! pViewShell( pViewSh )
{
SetOutDevViewType( OUTDEV_VIEWTYPE_PRINTPREVIEW ); //#106611#
SetBackground();
--- 124,147 ----
bInPaint( FALSE ),
bInGetState( FALSE ),
pDocShell( pDocSh ),
! pViewShell( pViewSh ),
! bLeftRulerChange( FALSE ),
! bRightRulerChange( FALSE ),
! bTopRulerChange( FALSE ),
! bBottomRulerChange( FALSE ),
! bHeaderRulerChange( FALSE ),
! bFooterRulerChange( FALSE ),
! bLeftRulerMove( FALSE ),
! bRightRulerMove( FALSE ),
! bTopRulerMove( FALSE ),
! bBottomRulerMove( FALSE ),
! bHeaderRulerMove( FALSE ),
! bFooterRulerMove( FALSE ),
! bPageMargin ( FALSE ),
! bColRulerMove( FALSE ),
! nColNumberButttonDown( 0 ),
! nHeaderHeight ( 0 ),
! nFooterHeight ( 0 )
{
SetOutDevViewType( OUTDEV_VIEWTYPE_PRINTPREVIEW ); //#106611#
SetBackground();
***************
*** 461,473 ****
}
}
!
void __EXPORT ScPreview::Paint( const Rectangle& /* rRect */ )
{
! DoPrint( NULL );
pViewShell->UpdateScrollBars();
}
!
void __EXPORT ScPreview::Command( const CommandEvent& rCEvt )
{
--- 485,661 ----
}
}
! //Issue51656 Add resizeable margin on page preview from maoyg
void __EXPORT ScPreview::Paint( const Rectangle& /* rRect */ )
{
! if (!bValid)
! {
! CalcPages(0);
! RecalcPages();
! UpdateDrawView(); // Table possibly amended
! }
!
! Fraction aPreviewZoom( nZoom, 100 );
! Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
! MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
!
! ScModule* pScMod = SC_MOD();
! const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig();
! Color aBackColor( rColorCfg.GetColorValue(svtools::APPBACKGROUND).nColor );
!
! if ( aOffset.X() < 0 || aOffset.Y() < 0 )
! {
! SetMapMode( aMMMode );
! SetLineColor();
! SetFillColor(aBackColor);
!
! Size aWinSize = GetOutputSize();
! if ( aOffset.X() < 0 )
! DrawRect(Rectangle( 0, 0, -aOffset.X(), aWinSize.Height() ));
! if ( aOffset.Y() < 0 )
! DrawRect(Rectangle( 0, 0, aWinSize.Width(), -aOffset.Y() ));
! }
!
! long nLeftMargin = 0;
! long nRightMargin = 0;
! long nTopMargin = 0;
! long nBottomMargin = 0;
! BOOL bHeaderOn = FALSE;
! BOOL bFooterOn = FALSE;
!
! ScDocument* pDoc = pDocShell->GetDocument();
! BOOL bLayoutRTL = pDoc->IsLayoutRTL( nTab );
!
! Size aPageSize;
! if ( nPageNo < nTotalPages )
! {
! ScPrintOptions aOptions = SC_MOD()->GetPrintOptions();
!
! ScPrintFunc* pPrintFunc;
! if ( bStateValid )
! pPrintFunc = new ScPrintFunc( pDocShell, this, aState, &aOptions );
! else
! pPrintFunc = new ScPrintFunc( pDocShell, this, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions );
!
! pPrintFunc->SetOffset(aOffset);
! pPrintFunc->SetManualZoom(nZoom);
! pPrintFunc->SetDateTime(aDate,aTime);
! pPrintFunc->SetClearFlag(TRUE);
! pPrintFunc->SetUseStyleColor( pScMod->GetAccessOptions().GetIsForPagePreviews() );
! pPrintFunc->SetDrawView( pDrawView );
!
! // Multi Selection for one side must be something umstaendlich generated ...
! Range aPageRange( nPageNo+1, nPageNo+1 );
! MultiSelection aPage( aPageRange );
! aPage.SetTotalRange( Range(0,RANGE_MAX) );
! aPage.Select( aPageRange );
!
! long nPrinted = pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart );
! DBG_ASSERT(nPrinted<=1, "was'n nu los?");
!
! SetMapMode(aMMMode);
!
! //init nLeftMargin ... in the ScPrintFunc::InitParam!!!
! nLeftMargin = pPrintFunc->GetLeftMargin();
! nRightMargin = pPrintFunc->GetRightMargin();
! nTopMargin = pPrintFunc->GetTopMargin();
! nBottomMargin = pPrintFunc->GetBottomMargin();
! nHeaderHeight = pPrintFunc->GetHeader().nHeight;
! nFooterHeight = pPrintFunc->GetFooter().nHeight;
! bHeaderOn = pPrintFunc->GetHeader().bEnable;
! bFooterOn = pPrintFunc->GetFooter().bEnable;
!
! Rectangle aPixRect;
! Rectangle aRectCellPosition;
! GetLocationData().GetMainCellRange( aPageArea, aPixRect );
! for( SCCOL i = aPageArea.aStart.Col(); i <= aPageArea.aEnd.Col(); i++ )
! {
! GetLocationData().GetCellPosition( ScAddress( i,aPageArea.aStart.Row(),aPageArea.aStart.Tab()),aRectCellPosition );
! if( !bLayoutRTL )
! nRight[i] = aRectCellPosition.Right();
! else
! nRight[i] = aRectCellPosition.Left();
! }
!
! if ( nPrinted ) // If nothing, all gray draw
! {
! aPageSize = pPrintFunc->GetPageSize();
! aPageSize.Width() = (long) (aPageSize.Width() * HMM_PER_TWIPS );
! aPageSize.Height() = (long) (aPageSize.Height() * HMM_PER_TWIPS );
!
! nLeftMargin = (long) ( nLeftMargin * HMM_PER_TWIPS );
! nRightMargin = (long) ( nRightMargin * HMM_PER_TWIPS );
! nTopMargin = (long) ( nTopMargin * HMM_PER_TWIPS );
! nBottomMargin = (long) ( nBottomMargin * HMM_PER_TWIPS );
! nHeaderHeight = (long) ( nHeaderHeight * HMM_PER_TWIPS + nTopMargin );
! nFooterHeight = (long) ( nFooterHeight * HMM_PER_TWIPS + nBottomMargin );
! }
!
! if ( !bStateValid )
! {
! pPrintFunc->GetPrintState( aState );
! aState.nDocPages = nTotalPages;
! bStateValid = TRUE;
! }
!
! delete pPrintFunc;
! }
!
!
! long nPageEndX = aPageSize.Width() - aOffset.X();
! long nPageEndY = aPageSize.Height() - aOffset.Y();
! Size aWinSize = GetOutputSize();
! Point aWinEnd( aWinSize.Width(), aWinSize.Height() );
! BOOL bRight = nPageEndX <= aWinEnd.X();
! BOOL bBottom = nPageEndY <= aWinEnd.Y();
!
! if( bPageMargin )
! {
! SetMapMode(aMMMode);
! SetLineColor( COL_BLACK );
! DrawInvert( (long)( nTopMargin - aOffset.Y() ), POINTER_VSIZEBAR );
! DrawInvert( (long)(nPageEndY - nBottomMargin ), POINTER_VSIZEBAR );
! DrawInvert( (long)( nLeftMargin - aOffset.X() ), POINTER_HSIZEBAR );
! DrawInvert( (long)( nPageEndX - nRightMargin ) , POINTER_HSIZEBAR );
! if( bHeaderOn )
! {
! DrawInvert( nHeaderHeight - aOffset.Y(), POINTER_VSIZEBAR );
! }
! if( bFooterOn )
! {
! DrawInvert( nPageEndY - nFooterHeight, POINTER_VSIZEBAR );
! }
!
! SetMapMode( MapMode( MAP_PIXEL ) );
! for( int i= aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ )
! {
! Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode );
! SetLineColor( COL_BLACK );
! SetFillColor( COL_BLACK );
! DrawRect( Rectangle( Point( nRight[i] - 2, aColumnTop.Y() ),Point( nRight[i] + 2 , 4 + aColumnTop.Y()) ));
! DrawLine( Point( nRight[i], aColumnTop.Y() ), Point( nRight[i], 10 + aColumnTop.Y()) );
! }
! SetMapMode( aMMMode );
! }
!
! if (bRight || bBottom)
! {
! SetMapMode(aMMMode);
! SetLineColor();
! SetFillColor(aBackColor);
! if (bRight)
! DrawRect(Rectangle(nPageEndX,0, aWinEnd.X(),aWinEnd.Y()));
! if (bBottom)
! {
! if (bRight)
! DrawRect(Rectangle(0,nPageEndY, nPageEndX,aWinEnd.Y())); // Ecke nicht doppelt
! else
! DrawRect(Rectangle(0,nPageEndY, aWinEnd.X(),aWinEnd.Y()));
! }
! }
pViewShell->UpdateScrollBars();
}
! //Issue51656 Add resizeable margin on page preview from maoyg
void __EXPORT ScPreview::Command( const CommandEvent& rCEvt )
{
***************
*** 707,712 ****
--- 895,901 ----
Invalidate();
}
InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED );
+ Paint(Rectangle());
}
***************
*** 733,738 ****
--- 922,928 ----
Invalidate();
}
InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED );
+ Paint(Rectangle());
}
***************
*** 802,807 ****
--- 992,1480 ----
}
}
+ //Issue51656 Add resizeable margin on page preview from maoyg
+ void __EXPORT ScPreview::MouseButtonDown( const MouseEvent& rMEvt )
+ {
+ Fraction aPreviewZoom( nZoom, 100 );
+ Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
+
+ aButtonDownChangePoint = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
+ aButtonDownPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
+
+ CaptureMouse();
+
+ if( rMEvt.IsLeft() && GetPointer() == POINTER_HSIZEBAR )
+ {
+ SetMapMode( aMMMode );
+ if( bLeftRulerChange )
+ {
+ DrawInvert( aButtonDownChangePoint.X(), POINTER_HSIZEBAR );
+ bLeftRulerMove = TRUE;
+ bRightRulerMove = FALSE;
+ }
+ else if( bRightRulerChange )
+ {
+ DrawInvert( aButtonDownChangePoint.X(), POINTER_HSIZEBAR );
+ bLeftRulerMove = FALSE;
+ bRightRulerMove = TRUE;
+ }
+ }
+
+ if( rMEvt.IsLeft() && GetPointer() == POINTER_VSIZEBAR )
+ {
+ SetMapMode( aMMMode );
+ if( bTopRulerChange )
+ {
+ DrawInvert( aButtonDownChangePoint.Y(), POINTER_VSIZEBAR );
+ bTopRulerMove = TRUE;
+ bBottomRulerMove = FALSE;
+ }
+ else if( bBottomRulerChange )
+ {
+ DrawInvert( aButtonDownChangePoint.Y(), POINTER_VSIZEBAR );
+ bTopRulerMove = FALSE;
+ bBottomRulerMove = TRUE;
+ }
+ else if( bHeaderRulerChange )
+ {
+ DrawInvert( aButtonDownChangePoint.Y(), POINTER_VSIZEBAR );
+ bHeaderRulerMove = TRUE;
+ bFooterRulerMove = FALSE;
+ }
+ else if( bFooterRulerChange )
+ {
+ DrawInvert( aButtonDownChangePoint.Y(), POINTER_VSIZEBAR );
+ bHeaderRulerMove = FALSE;
+ bFooterRulerMove = TRUE;
+ }
+ }
+
+ if( rMEvt.IsLeft() && GetPointer() == POINTER_HSPLIT )
+ {
+ Point aNowPt = rMEvt.GetPosPixel();
+ int i = 0;
+ for( i = aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ )
+ {
+ if( aNowPt.X() < nRight[i] + 2 && aNowPt.X() > nRight[i] - 2 )
+ {
+ nColNumberButttonDown = i;
+ break;
+ }
+ }
+ if( i == aPageArea.aEnd.Col()+1 )
+ return;
+
+ SetMapMode( aMMMode );
+ DrawInvert( aButtonDownChangePoint.X(), POINTER_HSPLIT );
+ bColRulerMove = TRUE;
+ }
+ }
+
+ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
+ {
+ Fraction aPreviewZoom( nZoom, 100 );
+ Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
+
+ aButtonUpPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
+
+ long nWidth = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Width();
+ long nHeight = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Height();
+
+ if( rMEvt.IsLeft() && GetPointer() == POINTER_HSIZEBAR )
+ {
+ SetPointer( Pointer( POINTER_ARROW ) );
+ if( bLeftRulerChange )
+ aLeftRulerChangePt = aButtonUpPt;
+ else if( bRightRulerChange )
+ aRightRulerChangePt = aButtonUpPt;
+
+
+ BOOL bMoveRulerAction= TRUE;
+
+ ScDocument * pDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE );
+
+ SfxItemSet* pParamSet = NULL;
+ if (pStyleSheet)
+ pParamSet = &pStyleSheet->GetItemSet();
+ SvxLRSpaceItem* pLRItem = ( SvxLRSpaceItem*) &pParamSet->Get( ATTR_LRSPACE );
+
+ if(( bLeftRulerChange && ( aLeftRulerChangePt.X() <= ( 0 - aOffset.X() ) || aLeftRulerChangePt.X() > nWidth * HMM_PER_TWIPS - aOffset.X() ) )||
+ ( bRightRulerChange && ( aRightRulerChangePt.X() <= ( 0 - aOffset.X() ) || aRightRulerChangePt.X() > nWidth * HMM_PER_TWIPS -aOffset.X() ) ))
+ {
+ bMoveRulerAction = FALSE;
+ Paint(Rectangle(0,0,10000,10000));
+ }
+ else if( bLeftRulerChange && ( aLeftRulerChangePt.X() / HMM_PER_TWIPS > nWidth - pLRItem->GetRight() - aOffset.X() / HMM_PER_TWIPS ) )
+ {
+ bMoveRulerAction = FALSE;
+ Paint(Rectangle(0,0,10000,10000));
+ }
+ else if( bRightRulerChange && ( aRightRulerChangePt.X() / HMM_PER_TWIPS < pLRItem->GetLeft() - aOffset.X() / HMM_PER_TWIPS ) )
+ {
+ bMoveRulerAction = FALSE;
+ Paint(Rectangle(0,0,10000,10000));
+ }
+ else if( aButtonDownPt.X() == aButtonUpPt.X() )
+ {
+ bMoveRulerAction = FALSE;
+ DrawInvert( aButtonUpPt.X(), POINTER_HSIZEBAR );
+ }
+ if( bMoveRulerAction )
+ {
+ if( bLeftRulerChange && bLeftRulerMove )
+ pLRItem->SetLeft( (long)( aLeftRulerChangePt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS ), 100 );
+ else if( bRightRulerChange && bRightRulerMove )
+ pLRItem->SetRight( (long)( nWidth - aRightRulerChangePt.X() / HMM_PER_TWIPS - aOffset.X() / HMM_PER_TWIPS ),100 );
+
+ if ( ValidTab( nTab ) )
+ {
+ ScPrintFunc aPrintFunc( pDocShell, this, nTab );
+ aPrintFunc.UpdatePages();
+ }
+
+ Rectangle aRect(0,0,10000,10000);
+ Paint( aRect );
+ bLeftRulerChange = FALSE;
+ bRightRulerChange = FALSE;
+ }
+ bLeftRulerMove = FALSE;
+ bRightRulerMove = FALSE;
+ }
+
+ if( rMEvt.IsLeft() && GetPointer() == POINTER_VSIZEBAR )
+ {
+ SetPointer( POINTER_ARROW );
+ if( bTopRulerChange )
+ aTopRulerChangePt = aButtonUpPt;
+ else if( bBottomRulerChange )
+ aBottomRulerChangePt = aButtonUpPt;
+ else if( bHeaderRulerChange )
+ aHeaderRulerChangePt = aButtonUpPt;
+ else if( bFooterRulerChange )
+ aFooterRulerChangePt = aButtonUpPt;
+
+ BOOL bMoveRulerAction = TRUE;
+ if( ( bTopRulerChange && ( aTopRulerChangePt.Y() <= ( 0 - aOffset.Y() ) || aTopRulerChangePt.Y() > nHeight * HMM_PER_TWIPS -aOffset.Y() ) ) ||
+ ( bBottomRulerChange && ( aBottomRulerChangePt.Y() <= ( 0 - aOffset.Y() ) || aBottomRulerChangePt.Y() > nHeight * HMM_PER_TWIPS - aOffset.Y() ) ) ||
+ ( bHeaderRulerChange && ( aHeaderRulerChangePt.Y() <= ( 0 - aOffset.Y() ) || aHeaderRulerChangePt.Y() > nHeight * HMM_PER_TWIPS - aOffset.Y() ) ) ||
+ ( bFooterRulerChange && ( aFooterRulerChangePt.Y() <= ( 0 - aOffset.Y() ) || aFooterRulerChangePt.Y() > nHeight * HMM_PER_TWIPS -aOffset.Y() ) ) )
+ {
+ bMoveRulerAction = FALSE;
+ Paint( Rectangle(0,0,10000,10000) );
+ }
+ else if( aButtonDownPt.Y() == aButtonUpPt.Y() )
+ {
+ bMoveRulerAction = FALSE;
+ DrawInvert( aButtonUpPt.Y(), POINTER_VSIZEBAR );
+ }
+ if( bMoveRulerAction )
+ {
+ ScDocument * pDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE );
+ DBG_ASSERT( pStyleSheet, "PageStyle not found" );
+ if ( pStyleSheet )
+ {
+ SfxItemSet& rSet = pStyleSheet->GetItemSet();
+ SvxULSpaceItem* pULItem = ( SvxULSpaceItem*) &rSet.Get( ATTR_ULSPACE );
+
+ if( bTopRulerMove && bTopRulerChange )
+ pULItem->SetUpper( (USHORT)( aTopRulerChangePt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS ), 100 );
+ else if( bBottomRulerMove && bBottomRulerChange )
+ pULItem->SetLower( (USHORT)( nHeight - aBottomRulerChangePt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS ), 100 );
+ else if( bHeaderRulerMove && bHeaderRulerChange )
+ {
+ const SfxPoolItem* pItem = NULL;
+ if ( rSet.GetItemState( ATTR_PAGE_HEADERSET, FALSE, &pItem ) == SFX_ITEM_SET )
+ {
+ SfxItemSet& pHeaderSet = ((SvxSetItem*)pItem)->GetItemSet();
+ Size aHeaderSize = ((const SvxSizeItem&)pHeaderSet.Get(ATTR_PAGE_SIZE)).GetSize();
+ aHeaderSize.Height() = (long)( aHeaderRulerChangePt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS - pULItem->GetUpper());
+ aHeaderSize.Height() = aHeaderSize.Height();
+ SvxSetItem aNewHeader( (const SvxSetItem&)rSet.Get(ATTR_PAGE_HEADERSET) );
+ aNewHeader.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aHeaderSize ) );
+ rSet.Put( aNewHeader );
+ }
+ }
+ else if( bFooterRulerMove && bFooterRulerChange )
+ {
+ const SfxPoolItem* pItem = NULL;
+ if( rSet.GetItemState( ATTR_PAGE_FOOTERSET, FALSE, &pItem ) == SFX_ITEM_SET )
+ {
+ SfxItemSet& pFooterSet = ((SvxSetItem*)pItem)->GetItemSet();
+ Size aFooterSize = ((const SvxSizeItem&)pFooterSet.Get(ATTR_PAGE_SIZE)).GetSize();
+ aFooterSize.Height() = (long)( nHeight - aFooterRulerChangePt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS - pULItem->GetLower() );
+ aFooterSize.Height() = aFooterSize.Height();
+ SvxSetItem aNewFooter( (const SvxSetItem&)rSet.Get(ATTR_PAGE_FOOTERSET) );
+ aNewFooter.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aFooterSize ) );
+ rSet.Put( aNewFooter );
+ }
+ }
+
+ if ( ValidTab( nTab ) )
+ {
+ ScPrintFunc aPrintFunc( pDocShell, this, nTab );
+ aPrintFunc.UpdatePages();
+ }
+
+ Rectangle aRect(0,0,10000,10000);
+ Paint( aRect );
+ bTopRulerChange = FALSE;
+ bBottomRulerChange = FALSE;
+ bHeaderRulerChange = FALSE;
+ bFooterRulerChange = FALSE;
+ }
+ }
+ bTopRulerMove = FALSE;
+ bBottomRulerMove = FALSE;
+ bHeaderRulerMove = FALSE;
+ bFooterRulerMove = FALSE;
+ }
+ if( rMEvt.IsLeft() && GetPointer() == POINTER_HSPLIT )
+ {
+ SetPointer(POINTER_ARROW);
+ BOOL bMoveRulerAction = TRUE;
+ if( aButtonDownPt.X() == aButtonUpPt.X() )
+ {
+ bMoveRulerAction = FALSE;
+ DrawInvert( aButtonUpPt.X(), POINTER_HSPLIT );
+ }
+ if( bMoveRulerAction )
+ {
+ ScDocument * pDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE );
+ SfxItemSet* pParamSet = NULL ;
+ if (pStyleSheet)
+ pParamSet = &pStyleSheet->GetItemSet();
+
+ SvxLRSpaceItem* pLRItem = ( SvxLRSpaceItem*) &pParamSet->Get( ATTR_LRSPACE );
+ long nLeftMargin = pLRItem->GetLeft();
+ long nRightMargin = pLRItem->GetRight();
+
+ SCCOL i;
+ Point aColRulerChangePt;
+ aColRulerChangePt = aButtonUpPt;
+ long nNewColWidth = 0;
+ i= (SCCOL)nColNumberButttonDown;
+
+ nNewColWidth = (long) ( PixelToLogic( Point( rMEvt.GetPosPixel().X() - nRight[ i ], 0), aMMMode ).X() / HMM_PER_TWIPS );
+ nNewColWidth += pDocShell->GetDocument()->GetColWidth( i, nTab );
+
+ if( nNewColWidth > 0 && aColRulerChangePt.X() / HMM_PER_TWIPS > nLeftMargin - (long)aOffset.X() / HMM_PER_TWIPS + 100 && aColRulerChangePt.X() / HMM_PER_TWIPS < (long)( nWidth - aOffset.X()/HMM_PER_TWIPS ) - nRightMargin - 100)
+ {
+ pDocShell->GetDocument()->SetColWidth( i, nTab, (USHORT)nNewColWidth );
+ }
+ if ( ValidTab( nTab ) )
+ {
+ ScPrintFunc aPrintFunc( pDocShell, this, nTab );
+ aPrintFunc.UpdatePages();
+ }
+ Rectangle nRect(0,0,10000,10000);
+ Paint( nRect );
+ }
+ bColRulerMove = FALSE;
+ }
+ ReleaseMouse();
+ }
+
+ void __EXPORT ScPreview::MouseMove( const MouseEvent& rMEvt )
+ {
+ Fraction aPreviewZoom( nZoom, 100 );
+ Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
+ Point aMouseMovePoint = PixelToLogic( rMEvt.GetPosPixel(), aMMMode );
+
+ long nLeftMargin = 0;
+ long nRightMargin = 0;
+ long nTopMargin = 0;
+ long nBottomMargin = 0;
+ Size PageSize;
+
+ long nWidth = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Width();
+ long nHeight = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Height();
+
+ if ( nPageNo < nTotalPages )
+ {
+ ScPrintOptions aOptions = SC_MOD()->GetPrintOptions();
+
+ ScPrintFunc* pPrintFunc;
+
+ if (bStateValid)
+ pPrintFunc = new ScPrintFunc( pDocShell, this, aState, &aOptions );
+ else
+ pPrintFunc = new ScPrintFunc( pDocShell, this, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions );
+
+ nLeftMargin = (long)( pPrintFunc->GetLeftMargin() * HMM_PER_TWIPS - aOffset.X() );
+ nRightMargin = (long)( pPrintFunc->GetRightMargin() * HMM_PER_TWIPS );
+ nRightMargin = (long)( nWidth * HMM_PER_TWIPS - nRightMargin - aOffset.X() );
+ nTopMargin = (long)( pPrintFunc->GetTopMargin() * HMM_PER_TWIPS - aOffset.Y() );
+ nBottomMargin = (long)( pPrintFunc->GetBottomMargin() * HMM_PER_TWIPS );
+ nBottomMargin = (long)( nHeight * HMM_PER_TWIPS - nBottomMargin - aOffset.Y() );
+ nHeaderHeight = (long)( nTopMargin + pPrintFunc->GetHeader().nHeight * HMM_PER_TWIPS );
+ nFooterHeight = (long)( nBottomMargin - pPrintFunc->GetFooter().nHeight * HMM_PER_TWIPS );
+ delete pPrintFunc;
+ }
+
+ Point aPixPt( rMEvt.GetPosPixel() );
+ Point aLeftTop = LogicToPixel( Point( nLeftMargin, -aOffset.Y() ) , aMMMode );
+ Point aLeftBottom = LogicToPixel( Point( nLeftMargin ,(long)(nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode );
+ Point aRightTop = LogicToPixel( Point( nRightMargin, -aOffset.Y() ), aMMMode );
+ Point aTopLeft = LogicToPixel( Point( -aOffset.X(), nTopMargin ), aMMMode );
+ Point aTopRight = LogicToPixel( Point( (long)(nWidth * HMM_PER_TWIPS - aOffset.X()), nTopMargin ), aMMMode );
+ Point aBottomLeft = LogicToPixel( Point( -aOffset.X(), nBottomMargin ), aMMMode );
+ Point aHeaderLeft = LogicToPixel( Point( -aOffset.X(), nHeaderHeight ), aMMMode );
+ Point aFooderLeft = LogicToPixel( Point( -aOffset.X(), nFooterHeight ), aMMMode );
+
+ BOOL bOnColRulerChange = FALSE;
+
+
+ for( SCCOL i=aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ )
+ {
+ Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode );
+ Point aColumnBottom = LogicToPixel( Point( 0, (long)( nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode );
+ if( aPixPt.X() < ( nRight[i] + 2 ) && ( aPixPt.X() > ( nRight[i] - 2 ) ) && ( aPixPt.X() < aRightTop.X() ) && ( aPixPt.X() > aLeftTop.X() )
+ && ( aPixPt.Y() > aColumnTop.Y() ) && ( aPixPt.Y() < aColumnBottom.Y() ) && !bLeftRulerMove && !bRightRulerMove
+ && !bTopRulerMove && !bBottomRulerMove && !bHeaderRulerMove && !bFooterRulerMove )
+ {
+ bOnColRulerChange = TRUE;
+ if( !rMEvt.GetButtons() && GetPointer() == POINTER_HSPLIT )
+ nColNumberButttonDown = i;
+ break;
+ }
+ }
+
+ if( aPixPt.X() < ( aLeftTop.X() + 2 ) && aPixPt.X() > ( aLeftTop.X() - 2 ) && !bRightRulerMove )
+ {
+ bLeftRulerChange = TRUE;
+ bRightRulerChange = FALSE;
+ }
+ else if( aPixPt.X() < ( aRightTop.X() + 2 ) && aPixPt.X() > ( aRightTop.X() - 2 ) && !bLeftRulerMove )
+ {
+ bLeftRulerChange = FALSE;
+ bRightRulerChange = TRUE;
+ }
+ else if( aPixPt.Y() < ( aTopLeft.Y() + 2 ) && aPixPt.Y() > ( aTopLeft.Y() - 2 ) && !bBottomRulerMove && !bHeaderRulerMove && !bFooterRulerMove )
+ {
+ bTopRulerChange = TRUE;
+ bBottomRulerChange = FALSE;
+ bHeaderRulerChange = FALSE;
+ bFooterRulerChange = FALSE;
+ }
+ else if( aPixPt.Y() < ( aBottomLeft.Y() + 2 ) && aPixPt.Y() > ( aBottomLeft.Y() - 2 ) && !bTopRulerMove && !bHeaderRulerMove && !bFooterRulerMove )
+ {
+ bTopRulerChange = FALSE;
+ bBottomRulerChange = TRUE;
+ bHeaderRulerChange = FALSE;
+ bFooterRulerChange = FALSE;
+ }
+ else if( aPixPt.Y() < ( aHeaderLeft.Y() + 2 ) && aPixPt.Y() > ( aHeaderLeft.Y() - 2 ) && !bTopRulerMove && !bBottomRulerMove && !bFooterRulerMove )
+ {
+ bTopRulerChange = FALSE;
+ bBottomRulerChange = FALSE;
+ bHeaderRulerChange = TRUE;
+ bFooterRulerChange = FALSE;
+ }
+ else if( aPixPt.Y() < ( aFooderLeft.Y() + 2 ) && aPixPt.Y() > ( aFooderLeft.Y() - 2 ) && !bTopRulerMove && !bBottomRulerMove && !bHeaderRulerMove )
+ {
+ bTopRulerChange = FALSE;
+ bBottomRulerChange = FALSE;
+ bHeaderRulerChange = FALSE;
+ bFooterRulerChange = TRUE;
+ }
+
+ if( bPageMargin )
+ {
+ if(( aPixPt.X() < ( aLeftTop.X() + 2 ) && aPixPt.X() > ( aLeftTop.X() - 2 ) || bLeftRulerMove ||
+ ( aPixPt.X() < ( aRightTop.X() + 2 ) && aPixPt.X() > ( aRightTop.X() - 2 ) ) || bRightRulerMove || bOnColRulerChange || bColRulerMove )
+ && aPixPt.Y() > aLeftTop.Y() && aPixPt.Y() < aLeftBottom.Y() )
+ {
+ if( bOnColRulerChange || bColRulerMove )
+ {
+ SetPointer( Pointer( POINTER_HSPLIT ) );
+ if( bColRulerMove )
+ {
+ if( aMouseMovePoint.X() > -aOffset.X() && aMouseMovePoint.X() < nWidth * HMM_PER_TWIPS - aOffset.X() )
+ DragMove( aMouseMovePoint.X(), POINTER_HSPLIT );
+ }
+ }
+ else
+ {
+ if( bLeftRulerChange && !bTopRulerMove && !bBottomRulerMove && !bHeaderRulerMove && !bFooterRulerMove )
+ {
+ SetPointer( Pointer( POINTER_HSIZEBAR ) );
+ if( bLeftRulerMove )
+ {
+ if( aMouseMovePoint.X() > -aOffset.X() && aMouseMovePoint.X() < nWidth * HMM_PER_TWIPS - aOffset.X() )
+ DragMove( aMouseMovePoint.X(), POINTER_HSIZEBAR );
+ }
+ }
+ else if( bRightRulerChange && !bTopRulerMove && !bBottomRulerMove && !bHeaderRulerMove && !bFooterRulerMove )
+ {
+ SetPointer( Pointer( POINTER_HSIZEBAR ) );
+ if( bRightRulerMove )
+ {
+ if( aMouseMovePoint.X() > -aOffset.X() && aMouseMovePoint.X() < nWidth * HMM_PER_TWIPS - aOffset.X() )
+ DragMove( aMouseMovePoint.X(), POINTER_HSIZEBAR );
+ }
+ }
+ }
+ }
+ else
+ {
+ if( ( ( aPixPt.Y() < ( aTopLeft.Y() + 2 ) && aPixPt.Y() > ( aTopLeft.Y() - 2 ) ) || bTopRulerMove ||
+ ( aPixPt.Y() < ( aBottomLeft.Y() + 2 ) && aPixPt.Y() > ( aBottomLeft.Y() - 2 ) ) || bBottomRulerMove ||
+ ( aPixPt.Y() < ( aHeaderLeft.Y() + 2 ) && aPixPt.Y() > ( aHeaderLeft.Y() - 2 ) ) || bHeaderRulerMove ||
+ ( aPixPt.Y() < ( aFooderLeft.Y() + 2 ) && aPixPt.Y() > ( aFooderLeft.Y() - 2 ) ) || bFooterRulerMove )
+ && aPixPt.X() > aTopLeft.X() && aPixPt.X() < aTopRight.X() )
+ {
+ if( bTopRulerChange )
+ {
+ SetPointer( Pointer( POINTER_VSIZEBAR ) );
+ if( bTopRulerMove )
+ {
+ if( aMouseMovePoint.Y() > -aOffset.Y() && aMouseMovePoint.Y() < nHeight * HMM_PER_TWIPS - aOffset.Y() )
+ DragMove( aMouseMovePoint.Y(), POINTER_VSIZEBAR );
+ }
+ }
+ else if( bBottomRulerChange )
+ {
+ SetPointer( Pointer( POINTER_VSIZEBAR ) );
+ if( bBottomRulerMove )
+ {
+ if( aMouseMovePoint.Y() > -aOffset.Y() && aMouseMovePoint.Y() < nHeight * HMM_PER_TWIPS - aOffset.Y() )
+ DragMove( aMouseMovePoint.Y(), POINTER_VSIZEBAR );
+ }
+ }
+ else if( bHeaderRulerChange )
+ {
+ SetPointer( Pointer( POINTER_VSIZEBAR ) );
+ if( bHeaderRulerMove )
+ {
+ if( aMouseMovePoint.Y() > -aOffset.Y() && aMouseMovePoint.Y() < nHeight * HMM_PER_TWIPS - aOffset.Y() )
+ DragMove( aMouseMovePoint.Y(), POINTER_VSIZEBAR );
+ }
+ }
+ else if( bFooterRulerChange )
+ {
+ SetPointer( Pointer( POINTER_VSIZEBAR ) );
+ if( bFooterRulerMove )
+ {
+ if( aMouseMovePoint.Y() > -aOffset.Y() && aMouseMovePoint.Y() < nHeight * HMM_PER_TWIPS - aOffset.Y() )
+ DragMove( aMouseMovePoint.Y(), POINTER_VSIZEBAR );
+ }
+ }
+ }
+ else
+ SetPointer( Pointer( POINTER_ARROW ) );
+ }
+ }
+ }
+ //Issue51656 Add resizeable margin on page preview from maoyg
void ScPreview::InvalidateLocationData(ULONG nId)
{
bLocationValid = FALSE;
***************
*** 830,833 ****
--- 1503,1549 ----
return xAccessible;
}
+ //Issue51656 Add resizeable margin on page preview from maoyg
+ void ScPreview::DragMove( long nDragMovePos, USHORT nFlags )
+ {
+ Fraction aPreviewZoom( nZoom, 100 );
+ Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
+ SetMapMode( aMMMode );
+ long nPos = nDragMovePos;
+ if( nFlags == POINTER_HSIZEBAR || nFlags == POINTER_HSPLIT )
+ {
+ if( nDragMovePos != aButtonDownChangePoint.X() )
+ {
+ DrawInvert( aButtonDownChangePoint.X(), nFlags );
+ aButtonDownChangePoint.X() = nPos;
+ DrawInvert( aButtonDownChangePoint.X(), nFlags );
+ }
+ }
+ else if( nFlags == POINTER_VSIZEBAR )
+ {
+ if( nDragMovePos != aButtonDownChangePoint.Y() )
+ {
+ DrawInvert( aButtonDownChangePoint.Y(), nFlags );
+ aButtonDownChangePoint.Y() = nPos;
+ DrawInvert( aButtonDownChangePoint.Y(), nFlags );
+ }
+ }
+ }
+ void ScPreview::DrawInvert( long nDragPos, USHORT nFlags )
+ {
+ long nHeight = (long) lcl_GetDocPageSize( pDocShell->GetDocument(), nTab ).Height();
+ long nWidth = (long) lcl_GetDocPageSize( pDocShell->GetDocument(), nTab ).Width();
+ if( nFlags == POINTER_HSIZEBAR || nFlags == POINTER_HSPLIT )
+ {
+ Rectangle aRect( nDragPos, -aOffset.Y(), nDragPos + 1,(long)( ( nHeight * HMM_PER_TWIPS ) - aOffset.Y()));
+ Invert( aRect,INVERT_50 );
+ }
+ else if( nFlags == POINTER_VSIZEBAR )
+ {
+ Rectangle aRect( -aOffset.X(), nDragPos,(long)( ( nWidth * HMM_PER_TWIPS ) - aOffset.X() ), nDragPos + 1 );
+ Invert( aRect,INVERT_50 );
+ }
+ }
+ //Issue51656 Add resizeable margin on page preview from maoyg
diff -cNr old/sc/source/ui/view/prevwsh.cxx new/sc/source/ui/view/prevwsh.cxx
*** old/sc/source/ui/view/prevwsh.cxx Wed Jan 9 15:41:12 2008
--- new/sc/source/ui/view/prevwsh.cxx Wed Jan 9 15:32:16 2008
***************
*** 708,713 ****
--- 708,721 ----
rReq.Done();
}
break;
+ case SID_PREVIEW_MARGIN:
+ {
+ BOOL bMargin = pPreview->GetPageMargins();
+ pPreview->SetPageMargins( !bMargin );
+ pPreview->Invalidate();
+ rReq.Done();
+ }
+ break;
case SID_PRINTPREVIEW:
case SID_PREVIEW_CLOSE:
// print preview is now always in the same frame as the tab view
***************
*** 790,797 ****
rSet.Put( SfxBoolItem( nWhich, TRUE ) );
break;
case SID_FORMATPAGE:
! //! bei geschuetzten Tabellen ???
! if (pDocShell->IsReadOnly())
rSet.DisableItem( nWhich );
break;
}
--- 798,805 ----
rSet.Put( SfxBoolItem( nWhich, TRUE ) );
break;
case SID_FORMATPAGE:
! case SID_PREVIEW_MARGIN:
! if( pDocShell->IsReadOnly() )
rSet.DisableItem( nWhich );
break;
}
diff -cNr old/sc/source/ui/view/printfun.cxx new/sc/source/ui/view/printfun.cxx
*** old/sc/source/ui/view/printfun.cxx Wed Jan 9 15:41:20 2008
--- new/sc/source/ui/view/printfun.cxx Thu Jan 24 16:50:10 2008
***************
*** 98,103 ****
--- 98,105 ----
#include "fillinfo.hxx"
+ #include "vcl/lineinfo.hxx"
+ #include
#define ZOOM_MIN 10
***************
*** 315,320 ****
--- 317,370 ----
Construct( pOptions );
}
+ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, SCTAB nTab,
+ long nPage, long nDocP, const ScRange* pArea,
+ const ScPrintOptions* pOptions )
+ : pDocShell ( pShell ),
+ pPrinter ( NULL ),
+ pDrawView ( NULL ),
+ nPrintTab ( nTab ),
+ nPageStart ( nPage ),
+ nDocPages ( nDocP ),
+ pUserArea ( pArea ),
+ pPageData ( NULL ),
+ nTotalPages ( 0 ),
+ nTabPages ( 0 ),
+ bState ( FALSE ),
+ bPrintCurrentTable ( FALSE ),
+ bMultiArea ( FALSE )
+ {
+ pDev = pWindow;
+ Construct( pOptions );
+ }
+ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow,
+ const ScPrintState& rState, const ScPrintOptions* pOptions )
+ : pDocShell ( pShell ),
+ pPrinter ( NULL ),
+ pDrawView ( NULL ),
+ pUserArea ( NULL ),
+ pPageData ( NULL ),
+ bPrintCurrentTable ( FALSE ),
+ bMultiArea ( FALSE )
+ {
+ pDev = pWindow;
+
+ nPrintTab = rState.nPrintTab;
+ nStartCol = rState.nStartCol;
+ nStartRow = rState.nStartRow;
+ nEndCol = rState.nEndCol;
+ nEndRow = rState.nEndRow;
+ nZoom = rState.nZoom;
+ nPagesX = rState.nPagesX;
+ nPagesY = rState.nPagesY;
+ nTabPages = rState.nTabPages;
+ nTotalPages = rState.nTotalPages;
+ nPageStart = rState.nPageStart;
+ nDocPages = rState.nDocPages;
+ bState = TRUE;
+
+ Construct( pOptions );
+ }
void ScPrintFunc::GetPrintState( ScPrintState& rState )
{
diff -cNr old/sc/uiconfig/scalc/toolbar/previewbar.xml new/sc/uiconfig/scalc/toolbar/previewbar.xml
*** old/sc/uiconfig/scalc/toolbar/previewbar.xml Mon Mar 21 21:39:24 2005
--- new/sc/uiconfig/scalc/toolbar/previewbar.xml Fri Dec 21 19:16:10 2007
***************
*** 14,18 ****
--- 14,20 ----
+
+
\ No newline at end of file