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 Wed Jan 9 15:30:46 2008 *************** *** 79,84 **** --- 79,120 ---- 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; + USHORT nScale; + 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 **** --- 130,138 ---- 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 **** --- 152,161 ---- void SetYOffset( long nY ); 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(); 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 Wed Jan 9 15:32:50 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,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 Wed Jan 9 15:41:04 2008 --- new/sc/source/ui/view/preview.cxx Wed Jan 9 15:31:58 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,150 ---- 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 ), ! nScale ( 0 ), ! 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(); } --- 491,687 ---- 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; ! //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(); ! nScale = ((const SfxUInt16Item&) pParamSet->Get(ATTR_PAGE_SCALE)).GetValue(); ! } ! //Because of the preview page in center,so modify the rulers' position! ! ! 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_HIDDEN /*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 * nScale / 100 * HMM_PER_TWIPS + nTopMargin ); ! nFooterHeight = (long) ( nFooterHeight * nScale / 100 * 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(); ! ! 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_GRAY); ! 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 * nScale / 100 ); ! else ! { ! long nAddOffset = (long)( aPageSize.Width() - nLeftMargin - nRightMargin - nColOffset[aPageArea.aEnd.Col()-1] * nScale / 100 - ( PRINT_HEADER_WIDTH ) * HMM_PER_TWIPS * nScale / 100 ) / 2; ! nLeftMargin += (long)( PRINT_HEADER_WIDTH * HMM_PER_TWIPS * nScale / 100 + nAddOffset ); ! } ! } ! else if( bCenterHor ) ! { ! long nAddOffset = (long)( aPageSize.Width() - nLeftMargin - nRightMargin - nColOffset[aPageArea.aEnd.Col()-1] * nScale / 100 ) / 2; ! nLeftMargin += nAddOffset ; ! } ! ! for( int i= aPageArea.aStart.Col(); i< aPageArea.aEnd.Col(); i++) ! { ! if( nColOffset[i] != 0 && (( nColOffset[i] * nScale / 100 + nLeftMargin ) < ( nPageEndX - nRightMargin )) ) ! { ! SetLineColor( COL_BLACK ); ! SetFillColor( COL_BLACK ); ! DrawRect( Rectangle( Point( ( nLeftMargin - aOffset.X() + nColOffset[i] * nScale / 100 - 50 ), -aOffset.Y() ),Point( ( nLeftMargin - aOffset.X() + nColOffset[i] * nScale / 100 + 50 ), 300 - aOffset.Y()) ) ); ! DrawLine( Point( ( nLeftMargin - aOffset.X() + nColOffset[i] * nScale / 100 ), -aOffset.Y() ), Point( ( nLeftMargin - aOffset.X() + nColOffset[i] * nScale / 100 ), 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 **** --- 924,930 ---- Invalidate(); } InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); + Paint(Rectangle()); } *************** *** 733,738 **** --- 951,957 ---- Invalidate(); } InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); + Paint(Rectangle()); } *************** *** 802,807 **** --- 1021,1643 ---- } } + 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(); + + if( rMEvt.IsLeft() && GetPointer() == POINTER_HSIZEBAR ) + { + 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 ) + { + DrawInvert( aButtonDownPt.X(), POINTER_HSIZEBAR ); + bLeftRulerMove = TRUE; + bRightRulerMove = FALSE; + } + else if( bRightRulerChange ) + { + DrawInvert( aButtonDownPt.X(), POINTER_HSIZEBAR ); + bLeftRulerMove = FALSE; + bRightRulerMove = TRUE; + } + } + + if( rMEvt.IsLeft() && GetPointer() == POINTER_VSIZEBAR ) + { + 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 * nScale / 100; + nHeaderHeight += nTopMargin; + nFooterHeight = pPrintFunc->GetFooter().nHeight * nScale / 100; + nFooterHeight += nBottomMargin; + delete pPrintFunc; + } + SetMapMode( aMMMode ); + SetLineColor( COL_BLUE ); + if( bTopRulerChange ) + { + DrawInvert( aButtonDownPt.Y(), POINTER_VSIZEBAR ); + bTopRulerMove = TRUE; + bBottomRulerMove = FALSE; + } + else if( bBottomRulerChange ) + { + DrawInvert( aButtonDownPt.Y(), POINTER_VSIZEBAR ); + bTopRulerMove = FALSE; + bBottomRulerMove = TRUE; + } + else if( bHeaderRulerChange ) + { + DrawInvert( aButtonDownPt.Y(), POINTER_VSIZEBAR ); + bHeaderRulerMove = TRUE; + bFooterRulerMove = FALSE; + } + else if( bFooterRulerChange ) + { + DrawInvert( aButtonDownPt.Y(), POINTER_VSIZEBAR ); + bHeaderRulerMove = FALSE; + bFooterRulerMove = TRUE; + } + } + + if( rMEvt.IsLeft() && 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_HIDDEN /*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 * nScale / 100; + else + { + long nAddOffset = (long)( nPageEndX - nRightMargin - nLeftMargin - nColOffset[aPageArea.aEnd.Col()-1] * nScale / 100 - ( PRINT_HEADER_WIDTH * nScale / 100 ))/2; + nLeftMargin += (long)( PRINT_HEADER_WIDTH * nScale / 100 + nAddOffset ); + } + } + else if( bCenterHor ) + { + + long nAddOffset = (long)( nPageEndX - nRightMargin - nLeftMargin - nColOffset[aPageArea.aEnd.Col()-1] * nScale / 100 )/2; + nLeftMargin += nAddOffset ; + } + + Point aNowPt = PixelToLogic( rMEvt.GetPosPixel(), aMMMode ); + int j = 0; + for( j=aPageArea.aStart.Col(); j (long)(( nColOffset[j] * nScale / 100 + 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; + + DrawInvert( aButtonDownPt.X(), POINTER_HSPLIT ); + } + } + + 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)); + } + 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 ); //!Countries without Pages auskommen + 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( 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( 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() * 100 / nScale; + 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() * 100 / nScale; + 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; + } + } + bTopRulerMove = FALSE; + bBottomRulerMove = FALSE; + bHeaderRulerMove = FALSE; + bFooterRulerMove = FALSE; + } + if( rMEvt.IsLeft() && 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 * nScale / 100; + else + { + long nAddOffset=(long)( nPageEndX - nRightMargin - nLeftMargin - ( nColOffset[ aPageArea.aEnd.Col() - 1 ] - nColOffset[ aPageArea.aStart.Col() - 1 ] ) / HMM_PER_TWIPS * nScale / 100 - ( PRINT_HEADER_WIDTH * nScale / 100 ))/2; + nLeftMargin+=(long)( PRINT_HEADER_WIDTH * nScale / 100 + nAddOffset ); + } + } + else if( bCenterHor ) + { + long nAddOffset=(long)( nPageEndX - nRightMargin - nLeftMargin - nColOffset[ aPageArea.aEnd.Col()-1 ] / HMM_PER_TWIPS * nScale / 100 ) / 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 ) * nScale / 100 - pDocShell->GetDocument()->GetColOffset(aPageArea.aStart.Col() - 1, nTab ) * nScale / 100 ) - nLeftMargin + aOffset.X() / HMM_PER_TWIPS ) > 0 ) + nNewColWidth = (long)( aColRulerChangePt.X() / HMM_PER_TWIPS - ( pDocShell->GetDocument()->GetColOffset( i-1, nTab ) * nScale / 100 - pDocShell->GetDocument()->GetColOffset(aPageArea.aStart.Col() - 1, nTab ) * nScale / 100 ) - nLeftMargin + aOffset.X() / HMM_PER_TWIPS ); + 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) + { + nNewColWidth = nNewColWidth * 100 / nScale; + pDocShell->GetDocument()->SetColWidth( i-1, nTab, (USHORT)nNewColWidth ); + } + if ( ValidTab( nTab ) ) + { + ScPrintFunc aPrintFunc( pDocShell, this, nTab ); //!Countries without Pages auskommen + aPrintFunc.UpdatePages(); + } + Paint( nRect ); + bColRulerMove = FALSE; + Point nZero(0,0); + aLastPointerChangeAndButtonNotDownPt = aPointerChangeAndButtonNotDownPt; + aPointerChangeAndButtonNotDownPt = nZero; + } + 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 ); + + 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 * nScale / 100 * HMM_PER_TWIPS ); + nFooterHeight = (long)( nBottomMargin - pPrintFunc->GetFooter().nHeight * nScale / 100 * 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_HIDDEN /*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 * nScale / 100 * HMM_PER_TWIPS ); + else + { + long nAddOffset = (long)( ( nWidth - nColRightMargin - nColLeftMargin - nColOffset[ aPageArea.aEnd.Col()-1] / HMM_PER_TWIPS * nScale / 100 - ( PRINT_HEADER_WIDTH * nScale / 100 ) ) * HMM_PER_TWIPS )/2; + nNewLeftMargin += (long)( PRINT_HEADER_WIDTH * HMM_PER_TWIPS * nScale / 100 + nAddOffset ); + } + } + else if(bCenterHor) + { + long nAddOffset = (long) ( ( nWidth - nColRightMargin - nColLeftMargin - ( nColOffset[aPageArea.aEnd.Col()-1] ) / HMM_PER_TWIPS * nScale / 100 ) * 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( aPixPt.X() < ( aLeftTop.X() + 2 ) && aPixPt.X() > ( aLeftTop.X() - 2 ) ) + { + bLeftRulerChange = TRUE; + bRightRulerChange = FALSE; + } + else if( aPixPt.X() < ( aRightTop.X() + 2 ) && aPixPt.X() > ( aRightTop.X() - 2 ) ) + { + bLeftRulerChange = FALSE; + bRightRulerChange = TRUE; + } + else if( aPixPt.Y() < ( aTopLeft.Y() + 2 ) && aPixPt.Y() > ( aTopLeft.Y() - 2 ) ) + { + bTopRulerChange = TRUE; + bBottomRulerChange = FALSE; + bHeaderRulerChange = FALSE; + bFooterRulerChange = FALSE; + } + else if( aPixPt.Y() < ( aBottomLeft.Y() + 2 ) && aPixPt.Y() > ( aBottomLeft.Y() - 2 ) ) + { + bTopRulerChange = FALSE; + bBottomRulerChange = TRUE; + bHeaderRulerChange = FALSE; + bFooterRulerChange = FALSE; + } + else if( aPixPt.Y() < ( aHeaderLeft.Y() + 2 ) && aPixPt.Y() > ( aHeaderLeft.Y() - 2 ) ) + { + bTopRulerChange = FALSE; + bBottomRulerChange = FALSE; + bHeaderRulerChange = TRUE; + bFooterRulerChange = FALSE; + } + else if( aPixPt.Y() < ( aFooderLeft.Y() + 2 ) && aPixPt.Y() > ( aFooderLeft.Y() - 2 ) ) + { + 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 || bOnColRuler || bColRulerMove ) + && aPixPt.Y() > aLeftTop.Y() && aPixPt.Y() < aLeftBottom.Y() ) + { + if( bOnColRuler || 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 ) + { + 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 ) + { + 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 ) + { + DragMove( aMouseMovePoint.Y(), POINTER_VSIZEBAR ); + } + } + else if( bBottomRulerChange ) + { + SetPointer( Pointer( POINTER_VSIZEBAR ) ); + if( bBottomRulerMove ) + { + DragMove( aMouseMovePoint.Y(), POINTER_VSIZEBAR ); + } + } + else if( bHeaderRulerChange ) + { + SetPointer( Pointer( POINTER_VSIZEBAR ) ); + if( bHeaderRulerMove ) + { + DragMove( aMouseMovePoint.Y(), POINTER_VSIZEBAR ); + } + } + else if( bFooterRulerChange ) + { + SetPointer( Pointer( POINTER_VSIZEBAR ) ); + if( bFooterRulerMove ) + { + DragMove( aMouseMovePoint.Y(), POINTER_VSIZEBAR ); + } + } + } + else + SetPointer( Pointer( POINTER_ARROW ) ); + } + } + } void ScPreview::InvalidateLocationData(ULONG nId) { bLocationValid = FALSE; *************** *** 830,833 **** --- 1666,1712 ---- return xAccessible; } + 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 != aButtonDownPt.X() ) + { + DrawInvert( aButtonDownPt.X(), nFlags ); + aButtonDownPt.X() = nPos; + DrawInvert( aButtonDownPt.X(), nFlags ); + } + } + else if( nFlags == POINTER_VSIZEBAR ) + { + if( nDragMovePos != aButtonDownPt.Y() ) + { + DrawInvert( aButtonDownPt.Y(), nFlags ); + aButtonDownPt.Y() = nPos; + DrawInvert( aButtonDownPt.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())); + Update(); + Invert( aRect ); + } + else if( nFlags == POINTER_VSIZEBAR ) + { + Rectangle aRect( -aOffset.X(), nDragPos,(long)( ( nWidth * HMM_PER_TWIPS ) - aOffset.X() ), nDragPos + 1 ); + Update(); + Invert( aRect ); + } + } 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 Wed Jan 9 15:37:04 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 ) { *************** *** 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 = 1; 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 = 1; 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