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 Tue Feb 27 21:25:30 2007
--- new/sc/source/ui/inc/preview.hxx Fri Dec 21 19:53:24 2007
***************
*** 79,84 ****
--- 79,119 ----
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 aPointerChangeAndButtonNotDownPt;
+ Point aLastPointerChangeAndButtonNotDownPt;
+ BOOL bColRulerMove;
+ BOOL bColHeader;
+ BOOL bCenterHor;
+ long nColOffset[ MAXCOL+1 ];
+ long nColWidth[ MAXCOL+1 ];
+ ScRange aPageArea;
+ ULONG nColNumberButttonDown;
+ USHORT nLeftMarginForFirstCol;
+ Point aButtonDownPt;
+ Point aButtonUpPt;
+ long nHeaderHeight;
+ long nFooterHeight;
void TestLastPage();
void CalcPages( SCTAB nToWhichTab );
***************
*** 94,99 ****
--- 129,137 ----
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();
***************
*** 113,118 ****
--- 151,158 ----
void SetYOffset( long nY );
void SetZoom(USHORT nNewZoom);
void SetPageNo( long nPage );
+ BOOL GetPageMargins()const { return bPageMargin; }
+ void SetPageMargins( BOOL bVal ) { bPageMargin = bVal; }
const ScPreviewLocationData& GetLocationData();
diff -cNr old/sc/source/ui/inc/printfun.hxx new/sc/source/ui/inc/printfun.hxx
*** old/sc/source/ui/inc/printfun.hxx Fri Sep 9 05:45:38 2005
--- new/sc/source/ui/inc/printfun.hxx Fri Dec 21 19:22:32 2007
***************
*** 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,333 ----
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;}
+ SCCOL GetEndCol(){return nEndCol;}
+ SCROW GetEndRow(){return nEndRow;}
+ ScRange GetRange(USHORT nTabPage, USHORT nTab);
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 Fri May 11 01:01:54 2007
--- new/sc/source/ui/view/preview.cxx Fri Dec 21 19:58:06 2007
***************
*** 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,149 ----
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 ),
! bColHeader( FALSE ),
! bCenterHor( FALSE ),
! nColNumberButttonDown( 0 ),
! nHeaderHeight ( 0 ),
! nFooterHeight ( 0 )
{
SetOutDevViewType( OUTDEV_VIEWTYPE_PRINTPREVIEW ); //#106611#
SetBackground();
***************
*** 464,470 ****
void __EXPORT ScPreview::Paint( const Rectangle& /* rRect */ )
{
! DoPrint( NULL );
pViewShell->UpdateScrollBars();
}
--- 490,685 ----
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;
! ULONG nOffset = 0;
! SCCOL nColCountOfTable = 0;
! //long nHeaderHeight = 0;
! //long nFooterHeight = 0;
!
! 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;
! nColCountOfTable = pPrintFunc->GetEndCol();
! aPageArea = pPrintFunc->GetRange((USHORT)nTabPage, nTab);
!
! for( SCCOL i=0; i <= nColCountOfTable + 1; i++ )
! {
! if( i > 0 )
! {
! if( pDocShell->GetDocument()->GetColFlags( i-1, nTab ) & ( CR_MANUALBREAK | CR_PAGEBREAK ) )
! nOffset = pDocShell->GetDocument()->GetColOffset( i-1, nTab );
! }
! nColOffset[i] = (ULONG)(( pDocShell->GetDocument()->GetColOffset( i, nTab ) - nOffset ) * HMM_PER_TWIPS );
! nColWidth[i] = (ULONG)( pDocShell->GetDocument()->GetColWidth( i, nTab ) * HMM_PER_TWIPS );
! }
!
! if ( nPrinted ) // If nothing, all gray draw
! {
! aPageSize = pPrintFunc->GetPageSize(); //HMM_PER_TWIPS = 1.757299
! 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(); //can not be deleted!!!
! Point aWinEnd( aWinSize.Width(), aWinSize.Height() );
! BOOL bRight = nPageEndX <= aWinEnd.X();
! BOOL bBottom = nPageEndY <= aWinEnd.Y();
!
! //QQQ from here!
! ScDocument* pDoc = pDocShell->GetDocument();
! ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
! SfxStyleSheetBase* pStyleSheet = pStylePool->Find(pDoc->GetPageStyle( nTab ),SFX_STYLE_FAMILY_PAGE );
! if ( pStyleSheet )
! {
! SfxItemSet* pParamSet = &pStyleSheet->GetItemSet();
! bColHeader = ((const SfxBoolItem&) pParamSet->Get(ATTR_PAGE_HEADERS)).GetValue();
! bCenterHor = ((const SfxBoolItem&) pParamSet->Get(ATTR_PAGE_HORCENTER)).GetValue();
! }
! long nRoFromHorPos;
! long nRoFromColPos;
! nRoFromHorPos = (aWinSize.Width() - aPageSize.Width())/2;
! nRoFromColPos = (aWinSize.Height() - aPageSize.Height())/2;
! //Because of the preview page in center,so modify the rulers' position!
! if( bPageMargin )
! {
! SetLineColor(COL_GRAY);
! LineInfo rLineInfo(LINE_SOLID,5);
! DrawLine(Point(nRoFromHorPos,nTopMargin-aOffset.Y()),Point(nPageEndX,nTopMargin-aOffset.Y()));
! DrawLine(Point(nRoFromHorPos,nPageEndY-nBottomMargin),Point(nPageEndX,nPageEndY-nBottomMargin));
! DrawLine(Point(nLeftMargin-aOffset.X(),nRoFromColPos),Point(nLeftMargin-aOffset.X(),nPageEndY));
! DrawLine(Point(nPageEndX-nRightMargin,nRoFromColPos),Point(nPageEndX-nRightMargin,nPageEndY));
! SetLineColor(COL_RED);
! DrawLine(Point(nRoFromHorPos,nHeaderHeight-aOffset.Y()),Point(nPageEndX,nHeaderHeight-aOffset.Y()));
! DrawLine(Point(nRoFromHorPos,nPageEndY-nFooterHeight),Point(nPageEndX,nPageEndY-nFooterHeight));
!
! //
! if( bColHeader )//do not delete!!!!!!!!!!!!!
! {
! if( !bCenterHor )
! nLeftMargin += (long) ( PRINT_HEADER_WIDTH * HMM_PER_TWIPS );
! else
! {
! long nAddOffset = (long)( aPageSize.Width() - nLeftMargin - nRightMargin - nColOffset[aPageArea.aEnd.Col()-1] - ( PRINT_HEADER_WIDTH ) * HMM_PER_TWIPS ) / 2;
! nLeftMargin += (long)( PRINT_HEADER_WIDTH * HMM_PER_TWIPS + nAddOffset );
! }
! }
! else if( bCenterHor )
! {
! long nAddOffset = (long)( aPageSize.Width() - nLeftMargin - nRightMargin - nColOffset[aPageArea.aEnd.Col()-1] ) / 2;
! nLeftMargin += nAddOffset ;
! }
!
! for( int i= aPageArea.aStart.Col(); i< aPageArea.aEnd.Col(); i++)
! {
! if( nColOffset[i] != 0 && (( nColOffset[i] + nLeftMargin ) < ( nPageEndX - nRightMargin )) )
! {
! SetLineColor( COL_BLACK );
! SetFillColor( COL_BLACK );
! DrawRect( Rectangle( Point( nLeftMargin - aOffset.X() + nColOffset[i] - 50, -aOffset.Y() ),Point( nLeftMargin - aOffset.X() + nColOffset[i] + 50, 300 - aOffset.Y()) ) );
! DrawLine( Point( nLeftMargin - aOffset.X() + nColOffset[i], -aOffset.Y() ), Point( nLeftMargin - aOffset.X() + nColOffset[i], 600 - aOffset.Y()) );
! }
! }
! }
!
! if (bRight || bBottom)
! {
! 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()));
! }
! }
! //DoPrint( NULL );
pViewShell->UpdateScrollBars();
}
***************
*** 707,712 ****
--- 922,928 ----
Invalidate();
}
InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED );
+ Paint(Rectangle());
}
***************
*** 733,738 ****
--- 949,955 ----
Invalidate();
}
InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED );
+ Paint(Rectangle());
}
***************
*** 802,807 ****
--- 1019,1583 ----
}
}
+ 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 );
+
+ if(!rMEvt.GetButtons()&&GetPointer()==POINTER_HSPLIT)
+ aPointerChangeAndButtonNotDownPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
+
+ long nLeftMargin = 0;// when offset is big enough, nLeftMargin can be negative
+ long nRightMargin = 0;
+ long nTopMargin = 0;
+ long nBottomMargin = 0;
+ long nColLeftMargin = 0;
+ long nColRightMargin = 0;
+ /* long nHeaderHeight = 0;
+ long nFooterHeight = 0;*/
+ ULONG nOffset=0;
+ SCCOL nColCountOfTable=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 );
+ nColCountOfTable = pPrintFunc->GetEndCol();
+ aPageArea = pPrintFunc->GetRange((USHORT)nTabPage, nTab);
+
+ nColLeftMargin = (long)pPrintFunc->GetLeftMargin();
+ nColRightMargin = (long)pPrintFunc->GetRightMargin();
+
+ for(SCCOL i=0; i<= nColCountOfTable+1; i++)
+ {
+ if( i>0 )
+ {
+ if( pDocShell->GetDocument()->GetColFlags(i-1, nTab) & ( CR_MANUALBREAK | CR_PAGEBREAK ) )
+ nOffset = pDocShell->GetDocument()->GetColOffset(i-1, nTab);
+ }
+ nColOffset[i] = (long)(( pDocShell->GetDocument()->GetColOffset( i, nTab) - nOffset ) * HMM_PER_TWIPS ) ;
+ nColWidth[i] =(long)( pDocShell->GetDocument()->GetColWidth(i, nTab) * 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 bOnColRuler=FALSE;
+ long nNewLeftMargin = nLeftMargin;//for first col offset
+
+ if(bColHeader)
+ {
+ if(!bCenterHor)
+ nNewLeftMargin += (long)( PRINT_HEADER_WIDTH * HMM_PER_TWIPS );
+ else
+ {
+ long nAddOffset = (long)( ( nWidth - nColRightMargin - nColLeftMargin - nColOffset[ aPageArea.aEnd.Col()-1] / HMM_PER_TWIPS - ( PRINT_HEADER_WIDTH ) ) * HMM_PER_TWIPS )/2;
+ nNewLeftMargin += (long)( PRINT_HEADER_WIDTH * HMM_PER_TWIPS + nAddOffset );
+ }
+ }
+ else if(bCenterHor)
+ {
+ long nAddOffset = (long) ( ( nWidth - nColRightMargin - nColLeftMargin - (nColOffset[aPageArea.aEnd.Col()-1]) / HMM_PER_TWIPS ) * HMM_PER_TWIPS )/2;
+ nNewLeftMargin += nAddOffset;
+ }
+
+ for( SCCOL i=aPageArea.aStart.Col(); i ( aColumnTop.X() - 2 ) ) && ( aPixPt.X() < aRightTop.X() ) && ( aPixPt.X() > aLeftTop.X() )
+ && ( aPixPt.Y() > aColumnTop.Y() ) && ( aPixPt.Y() < aColumnBottom.Y() ) )
+ {
+ bOnColRuler = TRUE;
+ if( !rMEvt.GetButtons() && GetPointer() == POINTER_HSPLIT ) //11-15
+ nColNumberButttonDown = i; //11-15
+ break;
+ }
+ }
+ 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 || bOnColRuler || bColRulerMove )
+ && aPixPt.Y() > aLeftTop.Y() && aPixPt.Y() < aLeftBottom.Y() )
+ {
+ if( bOnColRuler || bColRulerMove )
+ {
+ if( !bRightRulerMove && !bLeftRulerMove && !bTopRulerMove && !bBottomRulerMove && !bHeaderRulerMove && !bFooterRulerMove )
+ SetPointer( POINTER_HSPLIT );
+ }
+ else
+ {
+ if( !bRightRulerMove && !bLeftRulerMove && !bTopRulerMove && !bBottomRulerMove && !bHeaderRulerMove && !bFooterRulerMove )
+ {
+ SetPointer( POINTER_HSIZEBAR );
+ if( aPixPt.X() < ( aLeftTop.X() + 2 ) && aPixPt.X() > ( aLeftTop.X() - 2 ) && ( !bRightRulerMove ) )//!RightRulerMove ʹһ갴£Ҫתı߲ı
+ {
+ bLeftRulerChange = TRUE ;
+ bRightRulerChange = FALSE ;
+ }
+ if( aPixPt.X() < ( aRightTop.X() + 2 ) && aPixPt.X() > ( aRightTop.X() - 2 ) && ( !bLeftRulerMove ) )//!bLeft RulerMoveͬ
+ {
+ bRightRulerChange = TRUE;
+ bLeftRulerChange = FALSE;
+ }
+ }
+ }
+ }
+ 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() )
+ {
+ SetPointer( POINTER_VSIZEBAR );
+ if( aPixPt.Y() < ( aTopLeft.Y() + 2 ) && aPixPt.Y() > ( aTopLeft.Y() - 2 ) && !bHeaderRulerMove && !bFooterRulerMove && !bBottomRulerMove )
+ {
+ bTopRulerChange = TRUE;
+ bBottomRulerChange = FALSE;
+ bHeaderRulerChange = FALSE;
+ bFooterRulerChange = FALSE;
+ }
+ if( aPixPt.Y() < ( aBottomLeft.Y() + 2 ) && aPixPt.Y() > ( aBottomLeft.Y() - 2 ) && !bFooterRulerMove && !bHeaderRulerMove && !bTopRulerMove )
+ {
+ bTopRulerChange = FALSE;
+ bBottomRulerChange = TRUE;
+ bHeaderRulerChange = FALSE;
+ bFooterRulerChange = FALSE;
+ }
+ if( aPixPt.Y() < ( aHeaderLeft.Y() + 2 ) && aPixPt.Y() > ( aHeaderLeft.Y() - 2 ) && !bTopRulerMove && !bFooterRulerMove && !bBottomRulerMove )
+ {
+ bTopRulerChange = FALSE;
+ bBottomRulerChange = FALSE;
+ bHeaderRulerChange = TRUE;
+ bFooterRulerChange = FALSE;
+ }
+ if( aPixPt.Y() < ( aFooderLeft.Y() + 2 ) && aPixPt.Y() > ( aFooderLeft.Y() - 2 ) && !bBottomRulerMove && !bHeaderRulerMove && !bTopRulerMove )
+ {
+ bTopRulerChange = FALSE;
+ bBottomRulerChange = FALSE;
+ bHeaderRulerChange = FALSE;
+ bFooterRulerChange = TRUE;
+ }
+ }
+ else
+ SetPointer( POINTER_ARROW );
+ }
+ }
+ }
+
+ 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 );
+
+ aButtonDownPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
+
+ CaptureMouse();
+
+ long nWidth = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Width();
+ long nHeight = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Height();
+
+ if( rMEvt.GetButtons() == MOUSE_LEFT && GetPointer() == POINTER_HSIZEBAR )
+ {
+ if( bLeftRulerChange )
+ {
+ bLeftRulerMove = TRUE;
+ bRightRulerMove = FALSE;
+ }
+ if( bRightRulerChange )
+ {
+ bRightRulerMove = TRUE;
+ bLeftRulerMove = FALSE;
+ }
+ long nLeftMargin = 0;
+ long nRightMargin = 0;
+ if( nPageNo < nTotalPages )
+ { //TWIPS_PER_PIXEL = 15.056 //HMM_PER_TWIPS = 1.757299
+ 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() - aOffset.X()/HMM_PER_TWIPS );
+ nRightMargin = (long)( pPrintFunc->GetRightMargin() + aOffset.X() / HMM_PER_TWIPS );
+
+ delete pPrintFunc;
+ }
+ SetMapMode( aMMMode );
+ SetLineColor( COL_BLUE );
+ LineInfo rLineInfo(LINE_SOLID,5);
+ if( bLeftRulerChange )
+ DrawLine( Point( (long)(nLeftMargin * HMM_PER_TWIPS) ,(long)( 0 - aOffset.Y()) ), Point( (long)( nLeftMargin * HMM_PER_TWIPS ),(long)( nHeight * HMM_PER_TWIPS - aOffset.Y() )) );
+ if( bRightRulerChange )
+ DrawLine( Point((long)(( nWidth - nRightMargin ) * HMM_PER_TWIPS) ,( 0 - aOffset.Y())),Point((long)(( nWidth - nRightMargin ) * HMM_PER_TWIPS ),(long)( nHeight * HMM_PER_TWIPS - aOffset.Y() ) ));
+ }
+
+ if( rMEvt.GetButtons() == MOUSE_LEFT && GetPointer() == POINTER_VSIZEBAR )
+ {
+ if( bTopRulerChange )
+ bTopRulerMove = TRUE;
+ if( bBottomRulerChange )
+ bBottomRulerMove = TRUE;
+ if( bHeaderRulerChange )
+ {
+ bHeaderRulerMove = TRUE;
+ bFooterRulerMove = FALSE;
+ }
+ if( bFooterRulerChange )
+ {
+ bFooterRulerMove = TRUE;
+ bHeaderRulerMove = FALSE;
+ }
+
+ long nTopMargin = 0;
+ long nBottomMargin = 0;
+ /*long nHeaderHeight = 0;
+ long nFooterHeight = 0;*/
+ 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 );
+ nTopMargin = (long)( pPrintFunc->GetTopMargin() - aOffset.Y() / HMM_PER_TWIPS );
+ nBottomMargin = (long)( pPrintFunc->GetBottomMargin() + aOffset.Y() / HMM_PER_TWIPS );
+ nHeaderHeight = (long)pPrintFunc->GetHeader().nHeight;
+ nHeaderHeight += nTopMargin;
+ nFooterHeight = pPrintFunc->GetFooter().nHeight;
+ nFooterHeight += nBottomMargin;
+ delete pPrintFunc;
+ }
+ SetMapMode( aMMMode );
+ SetLineColor( COL_BLUE );
+ if( bTopRulerChange )
+ DrawLine(Point((long)( 0 - aOffset.X() ), (long)(nTopMargin * HMM_PER_TWIPS )),Point((long)( nWidth * HMM_PER_TWIPS - aOffset.X() ), (long)( nTopMargin * HMM_PER_TWIPS ) ));
+ if( bBottomRulerChange )
+ DrawLine(Point((long)( 0 - aOffset.X() ), (long)(( nHeight - nBottomMargin ) * HMM_PER_TWIPS )),Point((long)( nWidth * HMM_PER_TWIPS - aOffset.X() ),(long)(( nHeight - nBottomMargin ) * HMM_PER_TWIPS) ));
+ if( bHeaderRulerChange )
+ DrawLine(Point((long)( 0 - aOffset.X() ), (long)( nHeaderHeight * HMM_PER_TWIPS )), Point((long)( nWidth * HMM_PER_TWIPS - aOffset.X() ), (long)( nHeaderHeight * HMM_PER_TWIPS )) );
+ if( bFooterRulerChange )
+ DrawLine(Point((long)( 0 - aOffset.X() ), (long)((nHeight - nFooterHeight ) * HMM_PER_TWIPS)), Point((long)( nWidth * HMM_PER_TWIPS - aOffset.X() ), (long)(( nHeight - nFooterHeight ) * HMM_PER_TWIPS )));
+ }
+
+ if( rMEvt.GetButtons() == MOUSE_LEFT && GetPointer() == POINTER_HSPLIT )
+ {
+ long nLeftMargin = 0; //when offset big enougn, it can be negative
+ long nRightMargin = 0;
+ USHORT nColCountOfTable = 0;
+ ULONG nOffset = 0;
+
+ 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();
+ nRightMargin = (long) pPrintFunc->GetRightMargin();
+ nColCountOfTable = pPrintFunc->GetEndCol();
+ aPageArea = pPrintFunc->GetRange( (USHORT)nTabPage, nTab );
+ delete pPrintFunc;
+ }
+
+ bColRulerMove = TRUE;
+ SetLineColor(COL_LIGHTGRAY);
+ SCCOL i=0;
+ for( i=0; i<= nColCountOfTable+1; i++ )
+ {
+ if( i > 0 )
+ {
+ if( pDocShell->GetDocument()->GetColFlags( i-1,nTab ) & ( CR_MANUALBREAK | CR_PAGEBREAK ) )
+ nOffset=pDocShell->GetDocument()->GetColOffset( i-1, nTab );
+ }
+ nColOffset[i] = ( pDocShell->GetDocument()->GetColOffset( i, nTab) - nOffset ) ;
+ nColWidth[i] = pDocShell->GetDocument()->GetColWidth( i, nTab );
+ }
+ long nPageEndX = nWidth;
+ if( bColHeader )
+ {
+ if( !bCenterHor )
+ nLeftMargin += (long)PRINT_HEADER_WIDTH;
+ else
+ {
+ long nAddOffset = (long)( nPageEndX - nRightMargin - nLeftMargin - nColOffset[aPageArea.aEnd.Col()-1] - ( PRINT_HEADER_WIDTH ))/2;
+ nLeftMargin += (long)( PRINT_HEADER_WIDTH + nAddOffset );
+ }
+ }
+ else if( bCenterHor )
+ {
+
+ long nAddOffset = (long)( nPageEndX - nRightMargin - nLeftMargin - nColOffset[aPageArea.aEnd.Col()-1] )/2;
+ nLeftMargin += nAddOffset ;
+ }
+
+ Point aNowPt = PixelToLogic( rMEvt.GetPosPixel(), aMMMode );
+ int j = 0;
+ for( j=aPageArea.aStart.Col(); j (long)(( nColOffset[j] + nLeftMargin - aOffset.X() / HMM_PER_TWIPS - 100 ) * HMM_PER_TWIPS) )
+ break;
+ }
+ if( j == aPageArea.aEnd.Col() )
+ return;
+ nColNumberButttonDown = j;
+ //**************end 11-18
+ SetMapMode( aMMMode );
+ SetLineColor( COL_BLUE );
+ i = (USHORT)nColNumberButttonDown;//11-15
+ if( i == aPageArea.aStart.Col() )
+ nColOffset[i-1] = 0;
+ DrawLine( Point( (long)( ( nColOffset[i-1] + nLeftMargin - aOffset.X() / HMM_PER_TWIPS ) * HMM_PER_TWIPS ), -aOffset.Y() ), Point( (long)(( nColOffset[i-1] + nLeftMargin - aOffset.X() / HMM_PER_TWIPS ) * HMM_PER_TWIPS ), (long)( nHeight * HMM_PER_TWIPS - aOffset.Y() ) ) );
+ DrawLine( Point( (long)( ( nColOffset[i] + nLeftMargin - aOffset.X() / HMM_PER_TWIPS ) * HMM_PER_TWIPS ), -aOffset.Y() ), Point( (long)(( nColOffset[i] + nLeftMargin - aOffset.X() / HMM_PER_TWIPS ) * HMM_PER_TWIPS ), (long)( nHeight * HMM_PER_TWIPS - aOffset.Y() ) ) );
+ }
+ }
+
+ 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.GetButtons() == MOUSE_LEFT && GetPointer() == POINTER_HSIZEBAR )
+ {
+ bLeftRulerMove = FALSE;
+ bRightRulerMove = FALSE;
+ SetPointer( POINTER_ARROW );
+ if( bLeftRulerChange )
+ aLeftRulerChangePt = aButtonUpPt;
+ 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));
+ }
+ if( bMoveRulerAction )
+ {
+ if( aButtonDownPt != aButtonUpPt && bLeftRulerChange )
+ pLRItem->SetLeft( (long)( aLeftRulerChangePt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS ), 100 );
+ if( aButtonDownPt != aButtonUpPt && bRightRulerChange )
+ pLRItem->SetRight( (long)( nWidth - aRightRulerChangePt.X() / HMM_PER_TWIPS - aOffset.X() / HMM_PER_TWIPS ),100 );
+
+ if ( ValidTab( nTab ) )
+ {
+ ScPrintFunc aPrintFunc( pDocShell, this, nTab ); //!Countries without Pages auskommen
+ aPrintFunc.UpdatePages();
+ }
+
+ Rectangle aRect(0,0,10000,10000);
+ Paint( aRect );
+ bLeftRulerChange = FALSE;
+ bRightRulerChange = FALSE;
+ }
+ }
+
+ if( rMEvt.GetButtons() == MOUSE_LEFT && GetPointer() == POINTER_VSIZEBAR )
+ {
+ bTopRulerMove = FALSE;
+ bBottomRulerMove = FALSE;
+ bHeaderRulerMove = FALSE;
+ bFooterRulerMove = FALSE;
+ SetPointer( POINTER_ARROW );
+ if( bTopRulerChange )
+ aTopRulerChangePt = aButtonUpPt;
+ if( bBottomRulerChange )
+ aBottomRulerChangePt = aButtonUpPt;
+ if( bHeaderRulerChange )
+ aHeaderRulerChangePt = aButtonUpPt;
+ 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( bHeaderRulerChange && aHeaderRulerChangePt.Y() / HMM_PER_TWIPS > nFooterHeight / HMM_PER_TWIPS )
+ {
+ bMoveRulerAction = FALSE;
+ Paint( Rectangle(0,0,10000,10000) );
+ }
+
+ 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( aButtonDownPt != aButtonUpPt && bTopRulerChange )
+ pULItem->SetUpper( (USHORT)( aTopRulerChangePt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS ), 100 );
+ if( aButtonDownPt != aButtonUpPt && bBottomRulerChange )
+ pULItem->SetLower( (USHORT)( nHeight - aBottomRulerChangePt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS ), 100 );
+ if( aButtonDownPt != aButtonUpPt && 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());
+ SvxSetItem aNewHeader( (const SvxSetItem&)rSet.Get(ATTR_PAGE_HEADERSET) );
+ aNewHeader.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aHeaderSize ) );
+ rSet.Put( aNewHeader );
+ }
+ }
+ if( aButtonDownPt != aButtonUpPt && 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() );
+ 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 ); //!Countries without Pages auskommen
+ aPrintFunc.UpdatePages();
+ }
+
+ Rectangle aRect(0,0,10000,10000);
+ Paint( aRect );
+ bTopRulerChange = FALSE;
+ bBottomRulerChange = FALSE;
+ bHeaderRulerChange = FALSE;
+ bFooterRulerChange = FALSE;
+ }
+ }
+ }
+ if( rMEvt.GetButtons() == MOUSE_LEFT && GetPointer() == POINTER_HSPLIT )
+ {
+ SetPointer(POINTER_ARROW);
+ 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(); //when offset is big enough, it can be negative
+ long nRightMargin = pLRItem->GetRight();
+ SCCOL i;
+ long nPageEndX = nWidth;
+ if( bColHeader )
+ {
+ if( !bCenterHor )
+ nLeftMargin+= (long)PRINT_HEADER_WIDTH;
+ else
+ {
+ long nAddOffset=(long)( nPageEndX - nRightMargin - nLeftMargin - nColOffset[ aPageArea.aEnd.Col()-1 ] / HMM_PER_TWIPS -( PRINT_HEADER_WIDTH ))/2;
+ nLeftMargin+=(long)( PRINT_HEADER_WIDTH + nAddOffset );
+ }
+ }
+ else if( bCenterHor )
+ {
+ long nAddOffset=(long)( nPageEndX - nRightMargin - nLeftMargin - nColOffset[ aPageArea.aEnd.Col()-1 ] / HMM_PER_TWIPS ) / 2;
+ nLeftMargin+= nAddOffset;
+ }
+ Rectangle nRect(0,0,10000,10000);
+ Point aColRulerChangePt = aButtonUpPt; //0514
+ long nNewColWidth=0;
+ i= (SCCOL)nColNumberButttonDown; //11-15
+ if( (long)( aColRulerChangePt.X() / HMM_PER_TWIPS ) - ( pDocShell->GetDocument()->GetColOffset(i-1, nTab) - pDocShell->GetDocument()->GetColOffset( aPageArea.aStart.Col()-1, nTab) ) - nLeftMargin + aOffset.X() / HMM_PER_TWIPS > 0 )
+ nNewColWidth = (long)( aColRulerChangePt.X() / HMM_PER_TWIPS - ( pDocShell->GetDocument()->GetColOffset( i-1, nTab ) - pDocShell->GetDocument()->GetColOffset( aPageArea.aStart.Col()-1, nTab ) ) - nLeftMargin + aOffset.X() / HMM_PER_TWIPS );
+ if( 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)
+ {
+ if( aButtonDownPt != aButtonUpPt )
+ pDocShell->GetDocument()->SetColWidth( i-1, nTab, (USHORT)nNewColWidth );
+ }
+ Paint( nRect );
+ bColRulerMove = FALSE;
+ Point nZero(0,0);
+ aLastPointerChangeAndButtonNotDownPt = aPointerChangeAndButtonNotDownPt;
+ aPointerChangeAndButtonNotDownPt = nZero;
+ }
+ ReleaseMouse();
+ }
void ScPreview::InvalidateLocationData(ULONG nId)
{
bLocationValid = FALSE;
diff -cNr old/sc/source/ui/view/prevwsh.cxx new/sc/source/ui/view/prevwsh.cxx
*** old/sc/source/ui/view/prevwsh.cxx Tue Nov 27 02:43:16 2007
--- new/sc/source/ui/view/prevwsh.cxx Fri Dec 21 19:24:28 2007
***************
*** 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,798 ****
rSet.Put( SfxBoolItem( nWhich, TRUE ) );
break;
case SID_FORMATPAGE:
! //! bei geschuetzten Tabellen ???
! if (pDocShell->IsReadOnly())
! rSet.DisableItem( nWhich );
break;
}
--- 798,806 ----
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 Thu Sep 27 21:56:38 2007
--- new/sc/source/ui/view/printfun.cxx Fri Dec 21 19:29:46 2007
***************
*** 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 )
{
***************
*** 3095,3100 ****
--- 3145,3220 ----
}
}
+ ScRange ScPrintFunc::GetRange(USHORT nTabPage, USHORT nTab)
+ {
+ BYTE nFlags;
+ USHORT nHorizontalPageCount = 1;
+ USHORT nVerticalPageCount = 1;
+
+ SCCOL nCol = 0;
+ SCROW nRow = 0;
+ for( nCol = 0; nCol < nEndCol + 1; nCol ++ )
+ {
+ BYTE nDocFl = pDocShell->GetDocument()->GetColFlags( nCol, nTab );
+ nFlags = nDocFl & ( CR_MANUALBREAK | CR_PAGEBREAK);
+ if( nFlags )
+ nHorizontalPageCount ++;
+ }
+ for( nRow = 0; nRow < nEndRow + 1; nRow ++ )
+ {
+ BYTE nDocFl = pDocShell->GetDocument()->GetRowFlags( nRow, nTab );
+ nFlags = nDocFl & ( CR_MANUALBREAK | CR_PAGEBREAK );
+ if( nFlags )
+ nVerticalPageCount ++;
+ }
+ BOOL bTop2Down = ((const SfxBoolItem&) pParamSet->Get(ATTR_PAGE_TOPDOWN)).GetValue();
+ USHORT nModNumber;
+
+ if( bTop2Down )
+ {
+ nModNumber = nVerticalPageCount;
+ if( nModNumber != 1 )
+ nTabPage = nTabPage / nModNumber;
+ }
+ else
+ {
+ nModNumber = nHorizontalPageCount;
+ if( nModNumber != 1 )
+ nTabPage = ( nTabPage ) % nModNumber;
+ }
+ USHORT nPgCount = 0;
+ for( nCol = 0; nCol < nEndCol + 1; nCol++ )
+ {
+ if( nPgCount == nTabPage )
+ break;
+ else
+ {
+ BYTE nDocFl = pDocShell->GetDocument()->GetColFlags( nCol, nTab );
+ nFlags = nDocFl & ( CR_MANUALBREAK | CR_PAGEBREAK );
+ if( nFlags )
+ nPgCount ++;
+ }
+ }
+ ScAddress aStart( nCol, 0, nTab );
+ while( nCol < nEndCol + 1 )
+ {
+ BYTE nDocFl = pDocShell->GetDocument()->GetColFlags( nCol, nTab );
+ nFlags = nDocFl & ( CR_MANUALBREAK | CR_PAGEBREAK );
+ if( nFlags )
+ {
+ break;
+ }
+ else
+ {
+ nCol ++;
+ }
+ }
+ ScAddress aEnd( nCol+1, 0, nTab );
+ if( aStart.Col() == 0 )
+ aStart.SetCol( 1 );
+ ScRange aTabPageArea( aStart, aEnd );
+ return aTabPageArea;
+ }
//------------------------------------------------------------------------
// class ScJobSetup
//------------------------------------------------------------------------
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